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/input/mouse.rs | 2 +- native/src/input/mouse/event.rs | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'native/src/input') diff --git a/native/src/input/mouse.rs b/native/src/input/mouse.rs index d37f5b96..69dc6b4c 100644 --- a/native/src/input/mouse.rs +++ b/native/src/input/mouse.rs @@ -3,4 +3,4 @@ mod button; mod event; pub use button::Button; -pub use event::Event; +pub use event::{Event, ScrollDelta}; diff --git a/native/src/input/mouse/event.rs b/native/src/input/mouse/event.rs index 7b68208f..478f9b4d 100644 --- a/native/src/input/mouse/event.rs +++ b/native/src/input/mouse/event.rs @@ -34,11 +34,22 @@ pub enum Event { }, /// The mouse wheel was scrolled. - WheelScrolled { + WheelScrolled { delta: ScrollDelta }, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum ScrollDelta { + Lines { /// The number of horizontal lines scrolled - delta_x: f32, + x: f32, /// The number of vertical lines scrolled - delta_y: f32, + y: f32, + }, + Pixels { + /// The number of horizontal pixels scrolled + x: f32, + /// The number of vertical pixels scrolled + y: f32, }, } -- cgit