You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When dragging to scroll in a ScrollArea, egui applies the drag velocity if the user releases their finger/mouse button mid-drag. However, this velocity is only updated when a drag actually takes place. If the cursor decelerates quickly, no drag events will be registered because it's not moving, and the velocity of the previous drag event will be used:
firefox_TBCANyJ9qf.mp4
To Reproduce
Steps to reproduce the behavior:
Open the egui demo app
Open a demo that lets you drag to scroll, e.g. the "Scroll a lot of lines" tab in the "Scrolling" demo, the "Misc Demos" window, or the "EasyMark Editor".
Drag a scrollable area quickly, then decelerate your dragging movement rapidly.
Release the mouse button and observe that the previous velocity is kept even if the cursor is currently not moving.
Expected behavior
No further scrolling should occur, as the cursor is completely still and hence has no velocity.
The text was updated successfully, but these errors were encountered:
Fixesemilk#5174. The drag velocity was not being updated unless the cursor
counted as "dragging", which only happens when it's in motion. This
effectively guarantees that the drag velocity will never be zero, even
if the cursor is not moving, and results in spurious scroll velocity
being applied when the cursor is released. Instead, we update the
velocity only when the drag is stopped, which is when the kinetic
scrolling actually needs to begin.
Fixesemilk#5174.
The drag velocity was not being updated unless the cursor counted as
"dragging", which only happens when it's in motion. This effectively
guarantees that the drag velocity will never be zero, even if the cursor
is not moving, and results in spurious scroll velocity being applied
when the cursor is released.
Instead, we update the velocity only when the drag is stopped, which is
when the kinetic scrolling actually needs to begin. Note that we
immediately *apply* the scroll velocity on the same frame that we first
set it, to avoid a 1-frame gap where the scroll area doesn't move.
I believe that *not* setting `scroll_stuck_to_end` and `offset_target`
when the drag is released is the correct thing to do, as they should
apply immediately once the user stops dragging. Should we maybe clear
the drag velocity instead if `scroll_stuck_to_end` is true or
`offset_target` exists?
* Closesemilk#5174
* [x] I have followed the instructions in the PR template
Describe the bug
When dragging to scroll in a
ScrollArea
, egui applies the drag velocity if the user releases their finger/mouse button mid-drag. However, this velocity is only updated when a drag actually takes place. If the cursor decelerates quickly, no drag events will be registered because it's not moving, and the velocity of the previous drag event will be used:firefox_TBCANyJ9qf.mp4
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No further scrolling should occur, as the cursor is completely still and hence has no velocity.
The text was updated successfully, but these errors were encountered: