Fix scrollwheel events in uniformlist

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-04-26 15:53:38 -07:00
co-authored by Nathan Sobo
parent 733dc15c32
commit 09f5c7c23e
+5 -12
View File
@@ -74,10 +74,6 @@ where
scroll_max: f32,
ctx: &mut EventContext,
) -> bool {
if !self.rect().unwrap().contains_point(position) {
return false;
}
if !precise {
todo!("still need to handle non-precise scroll events from a mouse wheel");
}
@@ -111,11 +107,6 @@ where
fn scroll_top(&self) -> f32 {
self.state.0.lock().scroll_top
}
fn rect(&self) -> Option<RectF> {
todo!()
// try_rect(self.origin, self.size)
}
}
impl<F> Element for UniformList<F>
@@ -213,7 +204,7 @@ where
fn dispatch_event(
&mut self,
event: &Event,
_: RectF,
bounds: RectF,
layout: &mut Self::LayoutState,
_: &mut Self::PaintState,
ctx: &mut EventContext,
@@ -229,8 +220,10 @@ where
delta,
precise,
} => {
if self.scroll(*position, *delta, *precise, layout.scroll_max, ctx) {
handled = true;
if bounds.contains_point(*position) {
if self.scroll(*position, *delta, *precise, layout.scroll_max, ctx) {
handled = true;
}
}
}
_ => {}