mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
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:
parent
2c142e4c57
commit
3cf81f1930
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue