kill velocity after overscroll (#126)

This commit is contained in:
Paul Shen 2021-01-20 13:25:52 -08:00 committed by GitHub
parent d77fd9e3dc
commit 577aa2699f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -307,8 +307,13 @@ impl Prepared {
state.scroll_start_offset_from_top = None;
}
let unbounded_offset_y = state.offset.y;
state.offset.y = state.offset.y.max(0.0);
state.offset.y = state.offset.y.min(max_offset);
#[allow(clippy::float_cmp)]
if state.offset.y != unbounded_offset_y {
state.vel = Vec2::zero();
}
// Avoid frame-delay by calculating a new handle rect:
let mut handle_rect = Rect::from_min_max(