Skip to content

Commit

Permalink
Merge pull request #95846 from jadoc/fix-tooltips
Browse files Browse the repository at this point in the history
Only reset the tooltip timer when the mouse has actually moved
  • Loading branch information
akien-mga committed Aug 26, 2024
2 parents 4d35306 + 125ff32 commit 40c17d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down

0 comments on commit 40c17d6

Please sign in to comment.