Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow closing the Mod customize header by click only when it was opened by click. #29459

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,22 @@ public void TestExpandedStatePersistsWhenClicked()
AddStep("hover header", () => InputManager.MoveMouseTo(header));
checkExpanded(true);

AddStep("click", () => InputManager.Click(MouseButton.Left));
checkExpanded(false);
AddStep("click", () => InputManager.Click(MouseButton.Left));
checkExpanded(true);

AddStep("move away", () => InputManager.MoveMouseTo(Vector2.One));
checkExpanded(true);

AddStep("hover header", () => InputManager.MoveMouseTo(header));
AddStep("click", () => InputManager.Click(MouseButton.Left));
checkExpanded(false);

AddStep("move away", () => InputManager.MoveMouseTo(Vector2.One));
checkExpanded(false);
}

[Test]
public void TestHoverExpandsAndCollapsesWhenHeaderClicked()
public void TestHoverExpandsAndKeepExpandWhenHeaderClicked()
{
AddStep("add customisable mod", () =>
{
Expand All @@ -154,7 +156,7 @@ public void TestHoverExpandsAndCollapsesWhenHeaderClicked()
checkExpanded(true);

AddStep("click", () => InputManager.Click(MouseButton.Left));
checkExpanded(false);
checkExpanded(true);
}

private void checkExpanded(bool expanded)
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Overlays/Mods/ModCustomisationHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ protected override bool OnClick(ClickEvent e)
{
ExpandedState.Value = ExpandedState.Value switch
{
ModCustomisationPanelState.Collapsed => ModCustomisationPanelState.Expanded,
_ => ModCustomisationPanelState.Collapsed
ModCustomisationPanelState.Expanded => ModCustomisationPanelState.Collapsed,
_ => ModCustomisationPanelState.Expanded
};
}

Expand Down
Loading