1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:52:55 +08:00

Ensure hold for menu button fades out if the cursor is never moved

Closes https://github.com/ppy/osu/discussions/16669.
This commit is contained in:
Dean Herbert 2022-01-28 14:48:34 +09:00
parent f32d56e213
commit 28c8e07e3f
2 changed files with 11 additions and 1 deletions

View File

@ -60,5 +60,15 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep($"{nameof(holdForMenuButton.Action)} was triggered", () => exitAction);
AddStep("Release", () => InputManager.ReleaseButton(MouseButton.Left));
}
[Test]
public void TestFadeOnNoInput()
{
AddStep("move mouse away", () => InputManager.MoveMouseTo(Vector2.One));
AddUntilStep("wait for text fade out", () => !getSpriteText().IsPresent);
AddUntilStep("wait for button fade out", () => holdForMenuButton.Alpha < 0.1f);
}
private SpriteText getSpriteText() => holdForMenuButton.Children.OfType<SpriteText>().First();
}
}

View File

@ -80,7 +80,7 @@ namespace osu.Game.Screens.Play.HUD
base.LoadComplete();
}
private float positionalAdjust;
private float positionalAdjust = 1; // Start at 1 to handle the case where a user never send positional input.
protected override bool OnMouseMove(MouseMoveEvent e)
{