Merge pull request #95846 from jadoc/fix-tooltips

Only reset the tooltip timer when the mouse has actually moved
This commit is contained in:
Rémi Verschelde 2024-08-26 22:45:28 +02:00
commit 40c17d6380
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -1933,7 +1933,12 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
}
}
if (!is_tooltip_shown && over->can_process()) {
// 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)) {
if (gui.tooltip_timer.is_valid()) {
gui.tooltip_timer->release_connections();
gui.tooltip_timer = Ref<SceneTreeTimer>();