Avoid redraw spam when tooltip follows cursor

This commit is contained in:
Héctor Ramón Jiménez 2025-10-08 03:46:32 +02:00
parent 25a96f8efc
commit d47c921b29
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F

View file

@ -203,6 +203,7 @@ where
) {
if let Event::Mouse(_) = event {
let state = tree.state.downcast_mut::<State>();
let previous_state = *state;
let was_idle = *state == State::Idle;
*state = cursor
@ -215,7 +216,9 @@ where
if was_idle != is_idle {
shell.invalidate_layout();
shell.request_redraw();
} else if self.position == Position::FollowCursor {
} else if self.position == Position::FollowCursor
&& *state != previous_state
{
shell.request_redraw();
}
}