Fix panic when scrolling non-overflowing lists

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2021-08-24 17:51:37 -06:00
co-authored by Max Brunsfeld
parent a79b32cfc2
commit 3ac489a8b6
+3 -2
View File
@@ -234,8 +234,9 @@ impl StateInner {
todo!("still need to handle non-precise scroll events from a mouse wheel");
}
let scroll_max = self.heights.summary().height - height;
self.scroll_top = (self.scroll_top - delta.y()).max(0.0).min(scroll_max);
let scroll_max = (self.heights.summary().height - height).max(0.);
self.scroll_top = (self.scroll_top - delta.y()).max(0.).min(scroll_max);
cx.notify();
true