Add `scroll_area::State::velocity` (#3300)

* Implement `has_momentum`

* Add doc comment

* Call it `has_velocity`

* Implement `velocity` method

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Barugon 2023-09-05 01:44:23 -07:00 committed by GitHub
parent 1b8e8cb38e
commit cf163cc954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -54,6 +54,11 @@ impl State {
pub fn store(self, ctx: &Context, id: Id) {
ctx.data_mut(|d| d.insert_persisted(id, self));
}
/// Get the current kinetic scrolling velocity.
pub fn velocity(&self) -> Vec2 {
self.vel
}
}
pub struct ScrollAreaOutput<R> {