Prevent updating bind target when hovering cancel and clear buttons instead

This commit is contained in:
Joehu 2020-08-02 12:52:12 -07:00
parent d49e54deb6
commit 7aafc018ad
1 changed files with 9 additions and 8 deletions

View File

@ -48,7 +48,7 @@ public bool MatchingFilter
public bool FilteringActive { get; set; }
private OsuSpriteText text;
private Drawable pressAKey;
private FillFlowContainer cancelAndClearButtons;
public FillFlowContainer<KeyButton> Buttons;
@ -80,7 +80,7 @@ private void load(OsuColour colours)
Hollow = true,
};
Children = new[]
Children = new Drawable[]
{
new Box
{
@ -99,7 +99,7 @@ private void load(OsuColour colours)
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
pressAKey = new FillFlowContainer
cancelAndClearButtons = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding(padding) { Top = height + padding * 2 },
@ -187,7 +187,8 @@ protected override void OnMouseUp(MouseUpEvent e)
if (bindTarget.IsHovered)
finalise();
else if (Buttons.Any(b => b.IsHovered))
// prevent updating bind target before clear button's action
else if (!cancelAndClearButtons.Any(b => b.IsHovered))
updateBindTarget();
}
@ -298,8 +299,8 @@ private void finalise()
if (HasFocus)
GetContainingInputManager().ChangeFocus(null);
pressAKey.FadeOut(300, Easing.OutQuint);
pressAKey.BypassAutoSizeAxes |= Axes.Y;
cancelAndClearButtons.FadeOut(300, Easing.OutQuint);
cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y;
}
protected override void OnFocus(FocusEvent e)
@ -307,8 +308,8 @@ protected override void OnFocus(FocusEvent e)
AutoSizeDuration = 500;
AutoSizeEasing = Easing.OutQuint;
pressAKey.FadeIn(300, Easing.OutQuint);
pressAKey.BypassAutoSizeAxes &= ~Axes.Y;
cancelAndClearButtons.FadeIn(300, Easing.OutQuint);
cancelAndClearButtons.BypassAutoSizeAxes &= ~Axes.Y;
updateBindTarget();
base.OnFocus(e);