Handle touchpad scroll events

This commit is contained in:
Héctor Ramón Jiménez 2019-10-29 19:00:46 +01:00
parent 29588f604a
commit bd5d871eb6
4 changed files with 46 additions and 11 deletions

View file

@ -3,4 +3,4 @@ mod button;
mod event;
pub use button::Button;
pub use event::Event;
pub use event::{Event, ScrollDelta};

View file

@ -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,
},
}