From bd5d871eb6630bc8f987d72c771032f878fb91b6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 29 Oct 2019 19:00:46 +0100 Subject: Handle touchpad scroll events --- native/src/widget/scrollable.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'native/src/widget') diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 76d12124..8a82be4f 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -64,11 +64,16 @@ where // TODO: Event capture. Nested scrollables should capture scroll events. if is_mouse_over { match event { - Event::Mouse(mouse::Event::WheelScrolled { - delta_y, .. - }) => { - // TODO: Configurable speed (?) - self.state.scroll(delta_y * 15.0, bounds, content_bounds); + Event::Mouse(mouse::Event::WheelScrolled { delta }) => { + match delta { + mouse::ScrollDelta::Lines { y, .. } => { + // TODO: Configurable speed (?) + self.state.scroll(y * 15.0, bounds, content_bounds); + } + mouse::ScrollDelta::Pixels { y, .. } => { + self.state.scroll(y, bounds, content_bounds); + } + } } _ => {} } -- cgit