osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

Fix tooltip position abruptly changing when content reaches edge of the screen

Open Joehuu opened this issue 4 months ago • 4 comments

  • Fixes https://github.com/ppy/osu/issues/34515
  • Mostly (fixes) https://github.com/ppy/osu/issues/33975
    • this doesn't address if the tooltip content is actually too big for the screen (i.e. easily done with >1.0 scale / mobile), would need some scaling logic or automatic scrolling of the content
      • but at that point, should the problematic custom tooltip be redesigned? can probably close the issue then if so

Just matches the x position logic. As indicated by the second issue, the previous logic didn't work to keep the tooltip content on screen when it gets moved to the top right of the cursor.

And as said in https://github.com/ppy/osu/issues/34515, this will match stable FWIW.

Before After
Kapture 2025-08-10 at 18 43 06 Kapture 2025-08-10 at 18 33 41
Kapture 2025-08-10 at 18 44 47 Kapture 2025-08-10 at 18 38 38

Joehuu avatar Aug 11 '25 02:08 Joehuu

I don't know that I agree with this. This makes it possible for the cursor to occlude the tooltip when the tooltip is clamped to the window. Especially visible on elements with tooltips on the bottom right corner of the window.

Before:

https://github.com/user-attachments/assets/c26c8b04-ebf6-41c6-b2fe-879e66bb7c24

After:

https://github.com/user-attachments/assets/dcdc807a-c125-485c-90d1-8bc6d5f869de

Will leave to @peppy to assess.

bdach avatar Aug 11 '25 08:08 bdach

Maybe the path of least resistance is a bool AllowCursorOverlap => false property on ITooltip so it can be special-cased? Personally I feel like this is always going to be wanted behaviour for IHasCustomTooltip and not for IHasTooltip, but not sure if that stands true in practice.

smoogipoo avatar Aug 11 '25 10:08 smoogipoo

If exposing as a property works for the usages we're trying to fix then I see this as the best solution.

For me, the case we want to consider is touch input. We don't want tooltips to overlap a user's finger to the point they can't read it. But in the linked cases, the tooltips are huge and this is less of a problem. I'd argue that if-tooltip-is-larger-than-finger, overlapping is fine.

peppy avatar Aug 12 '25 07:08 peppy

Here's the osu!-side branch (when I'm not here after this is merged): https://github.com/ppy/osu/compare/master...Joehuu:osu:tooltip-allow-cursor-overlap

The current true cases are these (ones pointed out in the issues): Screenshot 2025-08-15 at 4 32 07 PM

Joehuu avatar Aug 15 '25 23:08 Joehuu