Increase default visibility on touch platforms

This commit is contained in:
Dean Herbert 2024-08-19 20:28:02 +09:00
parent 005b1038a3
commit 6985e2e657
No known key found for this signature in database

View File

@ -30,6 +30,8 @@ namespace osu.Game.Screens.Play.HUD
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public override bool PropagatePositionalInputSubTree => alwaysShow.Value || touchActive.Value;
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
public readonly Bindable<bool> ReplayLoaded = new Bindable<bool>();
@ -42,8 +44,6 @@ namespace osu.Game.Screens.Play.HUD
private Bindable<bool> alwaysShow;
public override bool PropagatePositionalInputSubTree => alwaysShow.Value || touchActive.Value;
public HoldForMenuButton()
{
Direction = FillDirection.Horizontal;
@ -123,10 +123,13 @@ namespace osu.Game.Screens.Play.HUD
{
base.Update();
// While the button is hovered or still animating, keep fully visible.
if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered)
Alpha = 1;
// When touch input is detected, keep visible at a constant opacity.
else if (touchActive.Value)
Alpha = 0.08f;
Alpha = 0.5f;
// Otherwise, if the user chooses, show it when the mouse is nearby.
else if (alwaysShow.Value)
{
float minAlpha = touchActive.Value ? .08f : 0;
@ -136,9 +139,7 @@ namespace osu.Game.Screens.Play.HUD
Alpha, Math.Clamp(1 - positionalAdjust, minAlpha, 1), 0, 200, Easing.OutQuint);
}
else
{
Alpha = 0;
}
}
private partial class HoldButton : HoldToConfirmContainer, IKeyBindingHandler<GlobalAction>