MouseDemo: Restart timer when scrolling to avoid blinking indicator

When scrolling, a timer is triggered to hide the indicator cross. When
we continuously scroll, the indicator cross would then blink once the
timer kicks in. Instead, let's cancel the current timer and schedule a
new one, making the indicator visually smooth.
This commit is contained in:
Andreas Oppebøen 2022-11-27 02:50:47 +01:00 committed by Sam Atkins
parent 2c142e4c57
commit 3cf81f1930

View file

@ -143,8 +143,9 @@ public:
m_wheel_delta_acc = (m_wheel_delta_acc + event.wheel_delta_y() + 36) % 36;
m_show_scroll_wheel = true;
update();
if (!has_timer())
start_timer(500);
if (has_timer())
stop_timer();
start_timer(500);
}
private: