Skip to content

Commit 59db1f8

Browse files
authored
Merge pull request #32447 from peppy/mod-customisation-grace
Add some lenience around mod customisation expanding overlay
2 parents c9c6042 + 52dad65 commit 59db1f8

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

osu.Game/Overlays/Mods/ModCustomisationPanel.cs

+17-4
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,28 @@ protected override void LoadComplete()
223223
inputManager = GetContainingInputManager()!;
224224
}
225225

226+
private double timeUntilCollapse;
227+
228+
private const double collapse_grace_time = 180;
229+
private const float collapse_grace_position = 40;
230+
226231
protected override void Update()
227232
{
228233
base.Update();
229234

230-
if (ExpandedState.Value == ModCustomisationPanelState.Expanded
231-
&& !ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position)
232-
&& inputManager.DraggedDrawable == null)
235+
if (ExpandedState.Value == ModCustomisationPanelState.Expanded)
233236
{
234-
ExpandedState.Value = ModCustomisationPanelState.Collapsed;
237+
bool canCollapse = !DrawRectangle.Inflate(new Vector2(collapse_grace_position)).Contains(ToLocalSpace(inputManager.CurrentState.Mouse.Position))
238+
&& inputManager.DraggedDrawable == null;
239+
240+
if (canCollapse)
241+
{
242+
if (timeUntilCollapse <= 0)
243+
ExpandedState.Value = ModCustomisationPanelState.Collapsed;
244+
timeUntilCollapse -= Time.Elapsed;
245+
}
246+
else
247+
timeUntilCollapse = collapse_grace_time;
235248
}
236249
}
237250
}

0 commit comments

Comments
 (0)