Invalidate mouse position when releasing final touch
This fixes an issue in mobile where if a user pressed a specific button in the game, the button will remain in a hovered state because that's where the mouse position was last at. Using the feedback of touch end event, we can put the mouse position in an "invalid" state such that any hovered drawable becomes unhovered, giving a more natural UX for mobile users.
For emphasizing purposes, the following are "broken" with this change:
- [ ] Tooltips, as they rely primarily on hover
- [ ]
ExpandingContainerusages (fixable)
Whether they are considered blockers for this PR or not is up for debate, so I'm keeping this PR open. The fixable parts will be fixed if this PR is agreed upon first (i.e. if tooltips do not block this).
Before:
https://github.com/user-attachments/assets/320cb5dc-d7ad-4e9a-9e52-ac91f4d016d9
After:
https://github.com/user-attachments/assets/5764a371-ebc1-48e6-824f-6d0fed15476a
(notice the buttons don't stay hovered after tapping them)
If this were to go in, MouseHandler.absolutePositionReceived needs to be updated.
Actually, I would consider this bug a feature. Hovering is used extensively throughout the UI of osu!, this bug is the only thing that makes it usable on mobile.
For example, when browsing the beatmap listing, I can "hover" a card and press the download button, way faster then going to the full beatmap page and downloading it there, especially if I want to download multiple beatmaps. The UX is bad because I have to do a short scroll, but it works /shrug
https://github.com/user-attachments/assets/fcb2185a-778d-4075-a4c7-0e4c0b44201c
If this were to go in,
MouseHandler.absolutePositionReceivedneeds to be updated.
I'm not sure how much it makes sense seeing that the property is only updated once to true and never reset again, but sure.
Actually, I would consider this bug a feature. Hovering is used extensively throughout the UI of osu!, this bug is the only thing that makes it usable on mobile.
From the basic concept of hovering, there should be a pointer on the screen pointing at said drawable to be in a hovered state. Whether that's a cursor, or a pen on a tablet (i.e. Apple Pencil). Hovering does not make sense on touchscreens in any way, shape, or form. This is awkward UI/UX, not a feature.
For example, when browsing the beatmap listing, I can "hover" a card and press the download button, way faster then going to the full beatmap page and downloading it there, especially if I want to download multiple beatmaps. The UX is bad because I have to do a short scroll, but it works /shrug
This is not valid UX, you don't touch the screen once and then the component changes it state, especially with its context being that of a ghost pointer hovering it. Downloading beatmaps from the beatmap listing in mobile devices is not in a good state generally, hovering should not be a requirement to press the download button, this should be reassessed. See https://github.com/ppy/osu/issues/31151.