egui/crates/emath
valadaptive ac2466d14f
Update ScrollArea drag velocity when drag stopped (#5175)
Fixes #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?

* Closes #5174
* [x] I have followed the instructions in the PR template
2024-10-02 18:12:36 +02:00
..
src Update ScrollArea drag velocity when drag stopped (#5175) 2024-10-02 18:12:36 +02:00
Cargo.toml Enable rustdoc `generate-link-to-definition` feature on docs.rs (#5030) 2024-08-30 11:22:29 +02:00
README.md Add badges to all crates' README.md 2023-02-12 18:08:13 +01:00

README.md

emath - egui math library

Latest version Documentation unsafe forbidden MIT Apache

A bare-bones 2D math library with types and functions useful for GUI building.

Made for egui.