mirror of
https://github.com/ppy/osu.git
synced 2026-05-30 04:39:54 +08:00
Merge pull request #32447 from peppy/mod-customisation-grace
Add some lenience around mod customisation expanding overlay
This commit is contained in:
@@ -223,15 +223,28 @@ namespace osu.Game.Overlays.Mods
|
||||
inputManager = GetContainingInputManager()!;
|
||||
}
|
||||
|
||||
private double timeUntilCollapse;
|
||||
|
||||
private const double collapse_grace_time = 180;
|
||||
private const float collapse_grace_position = 40;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (ExpandedState.Value == ModCustomisationPanelState.Expanded
|
||||
&& !ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position)
|
||||
&& inputManager.DraggedDrawable == null)
|
||||
if (ExpandedState.Value == ModCustomisationPanelState.Expanded)
|
||||
{
|
||||
ExpandedState.Value = ModCustomisationPanelState.Collapsed;
|
||||
bool canCollapse = !DrawRectangle.Inflate(new Vector2(collapse_grace_position)).Contains(ToLocalSpace(inputManager.CurrentState.Mouse.Position))
|
||||
&& inputManager.DraggedDrawable == null;
|
||||
|
||||
if (canCollapse)
|
||||
{
|
||||
if (timeUntilCollapse <= 0)
|
||||
ExpandedState.Value = ModCustomisationPanelState.Collapsed;
|
||||
timeUntilCollapse -= Time.Elapsed;
|
||||
}
|
||||
else
|
||||
timeUntilCollapse = collapse_grace_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user