From df58dc0ca2df897db5286fe1a131a0e5a44ad3ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Oct 2025 18:21:21 +0900 Subject: [PATCH] Fix hovering left area in song select not always activating reset action --- osu.Game/Screens/Select/SongSelect.cs | 31 ++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f923154873..606d53d884 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Logging; @@ -1137,6 +1138,10 @@ namespace osu.Game.Screens.Select { private readonly Action? resetCarouselPosition; + private bool mouseContained; + + private InputManager inputManager = null!; + public LeftSideInteractionContainer(Action resetCarouselPosition) { this.resetCarouselPosition = resetCarouselPosition; @@ -1149,10 +1154,30 @@ namespace osu.Game.Screens.Select protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnHover(HoverEvent e) + protected override void LoadComplete() { - resetCarouselPosition?.Invoke(); - return base.OnHover(e); + inputManager = GetContainingInputManager()!; + base.LoadComplete(); + } + + protected override void Update() + { + base.Update(); + + // We want to trigger an action whenever the cursor is in the left area of song select. + // Other elements in song select handle input, so rather than using `OnHover` let's check the true mouse position. + if (Contains(inputManager.CurrentState.Mouse.Position)) + { + if (!mouseContained) + { + mouseContained = true; + resetCarouselPosition?.Invoke(); + } + } + else + { + mouseContained = false; + } } } }