1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Merge pull request #18119 from bdach/mod-overlay/broken-hover

Fix mod panels not hovering correctly after closing customisation area via mouse on new mod select
This commit is contained in:
Dean Herbert 2022-05-06 20:42:33 +09:00 committed by GitHub
commit 98eab9668d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -18,6 +18,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.UserInterface
@ -164,7 +165,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
assertCustomisationToggleState(disabled: false, active: true);
AddStep("dismiss mod customisation via mouse", () =>
AddStep("dismiss mod customisation via toggle", () =>
{
InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType<ShearedToggleButton>().Single());
InputManager.Click(MouseButton.Left);
@ -191,6 +192,29 @@ namespace osu.Game.Tests.Visual.UserInterface
assertCustomisationToggleState(disabled: true, active: false); // config was dismissed without explicit user action.
}
[Test]
public void TestDismissCustomisationViaDimmedArea()
{
createScreen();
assertCustomisationToggleState(disabled: true, active: false);
AddStep("select mod requiring configuration", () => SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
assertCustomisationToggleState(disabled: false, active: true);
AddStep("move mouse to settings area", () => InputManager.MoveMouseTo(this.ChildrenOfType<ModSettingsArea>().Single()));
AddStep("move mouse to dimmed area", () =>
{
InputManager.MoveMouseTo(new Vector2(
modSelectScreen.ScreenSpaceDrawQuad.TopLeft.X,
(modSelectScreen.ScreenSpaceDrawQuad.TopLeft.Y + modSelectScreen.ScreenSpaceDrawQuad.BottomLeft.Y) / 2));
});
AddStep("click", () => InputManager.Click(MouseButton.Left));
assertCustomisationToggleState(disabled: false, active: false);
AddStep("move mouse to first mod panel", () => InputManager.MoveMouseTo(modSelectScreen.ChildrenOfType<ModPanel>().First()));
AddAssert("first mod panel is hovered", () => modSelectScreen.ChildrenOfType<ModPanel>().First().IsHovered);
}
/// <summary>
/// Ensure that two mod overlays are not cross polluting via central settings instances.
/// </summary>

View File

@ -464,6 +464,8 @@ namespace osu.Game.Overlays.Mods
public Action? OnClicked { get; set; }
public override bool HandlePositionalInput => base.HandlePositionalInput && HandleMouse.Value;
protected override bool Handle(UIEvent e)
{
if (!HandleMouse.Value)