1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:52:57 +08:00

Fix overlays closing when clicking any empty area of the toolbar instead

This commit is contained in:
Joseph Madamba 2021-08-28 22:25:13 -07:00
parent 38912bfc16
commit 9a5445bded
2 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -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);
}
}