From a456eb6f1b6d704e3ecaf64ddbb41c8221211abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 29 Nov 2016 21:12:49 +0100 Subject: [PATCH] Fix being able to hover the back button from outside of its shape. Could alternatively done by shearing the entire button, but then you would need a positional x-offset depending on whether the anchor is top or bottom. --- osu.Game/Graphics/UserInterface/BackButton.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 5de8537c17..7ccc5c061b 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -19,6 +19,9 @@ public class BackButton : ClickableContainer private Container leftContainer; private Container rightContainer; + private Box leftBox; + private Box rightBox; + private const double transform_time = 300.0; private const int pulse_length = 250; @@ -39,7 +42,7 @@ public BackButton() Width = 0.4f, Children = new Drawable[] { - new Box + leftBox = new Box { RelativeSizeAxes = Axes.Both, Colour = new Color4(195, 40, 140, 255), @@ -61,7 +64,7 @@ public BackButton() Width = 0.6f, Children = new Drawable[] { - new Box + rightBox = new Box { Colour = new Color4(238, 51, 153, 255), Origin = Anchor.TopLeft, @@ -80,6 +83,12 @@ public BackButton() } }; } + + public override bool Contains(Vector2 screenSpacePos) + { + return leftBox.Contains(screenSpacePos) || rightBox.Contains(screenSpacePos); + } + protected override bool OnHover(InputState state) { icon.ClearTransformations();