From 577aa2699f93dfcb481b197532f77a0f947d1928 Mon Sep 17 00:00:00 2001 From: Paul Shen Date: Wed, 20 Jan 2021 13:25:52 -0800 Subject: [PATCH] kill velocity after overscroll (#126) --- egui/src/containers/scroll_area.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/egui/src/containers/scroll_area.rs b/egui/src/containers/scroll_area.rs index f30868ac..2a0a63db 100644 --- a/egui/src/containers/scroll_area.rs +++ b/egui/src/containers/scroll_area.rs @@ -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(