summaryrefslogtreecommitdiffstats
path: root/native/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-29 19:00:46 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-29 19:00:46 +0100
commitbd5d871eb6630bc8f987d72c771032f878fb91b6 (patch)
tree528784f51a84abb0863590864a4af8f854d462e2 /native/src/widget
parent29588f604af66fb4911f791c0c402fccd30ba64b (diff)
downloadiced-bd5d871eb6630bc8f987d72c771032f878fb91b6.tar.gz
iced-bd5d871eb6630bc8f987d72c771032f878fb91b6.tar.bz2
iced-bd5d871eb6630bc8f987d72c771032f878fb91b6.zip
Handle touchpad scroll events
Diffstat (limited to 'native/src/widget')
-rw-r--r--native/src/widget/scrollable.rs15
1 files changed, 10 insertions, 5 deletions
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);
+ }
+ }
}
_ => {}
}