mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 17:13:06 +08:00
Fix overlays closing when clicking any empty area of the toolbar instead
This commit is contained in:
parent
38912bfc16
commit
9a5445bded
@ -75,14 +75,14 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
closeOnMouseUp = !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition);
|
||||
closeOnMouseUp = !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition) && (game?.Toolbar.IsHovered == false);
|
||||
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition) && (game?.Toolbar.IsHovered == false))
|
||||
Hide();
|
||||
|
||||
base.OnMouseUp(e);
|
||||
|
@ -41,6 +41,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
// Toolbar and its components need keyboard input even when hidden.
|
||||
public override bool PropagateNonPositionalInputSubTree => true;
|
||||
|
||||
// IsHovered is used
|
||||
public override bool HandlePositionalInput => true;
|
||||
|
||||
public Toolbar()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -140,12 +143,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
gradientBackground.FadeIn(transition_time, Easing.OutQuint);
|
||||
return true;
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
gradientBackground.FadeOut(transition_time, Easing.OutQuint);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user