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

Tooltip sometimes appears at old mouse position #96707

Closed
KoBeWi opened this issue Sep 8, 2024 · 2 comments · Fixed by #96721
Closed

Tooltip sometimes appears at old mouse position #96707

KoBeWi opened this issue Sep 8, 2024 · 2 comments · Fixed by #96721

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Sep 8, 2024

Tested versions

4.4 dev 5675c76
Not reproducible in 4.3

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 31.0.15.4633) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

If you move cursor before hovering over something with tooltip, the tooltip can appear at older mouse position.

WcVqifhu8C.mp4

Steps to reproduce

  1. Hover scene tree node while moving your cursor fast

Minimal reproduction project (MRP)

N/A

@Giganzo
Copy link
Contributor

Giganzo commented Sep 8, 2024

Looks like this happens after #95846 ?

@aXu-AP
Copy link
Contributor

aXu-AP commented Sep 8, 2024

It seems to me that this bit has a little logic problem:

godot/scene/main/viewport.cpp

Lines 1936 to 1941 in 5675c76

// If the tooltip timer isn't running, start it.
// Otherwise, only reset the timer if the mouse has moved more than 5 pixels.
if (!is_tooltip_shown && over->can_process() &&
(gui.tooltip_timer.is_null() ||
Math::is_zero_approx(gui.tooltip_timer->get_time_left()) ||
mm->get_relative().length() > 5.0)) {

The intent is that if the mouse has moved 5 pixels reset the tooltip timer. However, mm->get_relative() gets the relative motion to the last inputevent, not in relation to where the timer was started. So it means like 5 pixels per frame (or however often inputevent are triggered).
So the bug is a bit more severe, tooltip appears even if the mouse is in steady motion.
tooltip

I think solution to this would be either use the initial version of #95846 (check that relative motion != zero), or if we really want that 5 px leeway, save the starting position. But I think zero movement is good enough, the situation is different from doubleclicking, since to show tooltip you can just not touch the mouse (vs accessibility problem of doubleclicking without moving mouse).

Edit: After testing the first solution I mentioned, it seems to fix the problem I found but not the original issue. I still think it's going to be one solution that fixes both of these, so I won't open a separate issue just yet.

Edit2: I tried implementing the second solution and it seems to work well. There wasn't even need to introduce a new property for tracking the position, I hijacked the existing gui.tooltip_pos 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Unassessed
Development

Successfully merging a pull request may close this issue.

3 participants