aboutsummaryrefslogtreecommitdiffstats
path: root/src/events.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/events.rs')
-rw-r--r--src/events.rs21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/events.rs b/src/events.rs
index 7962706..1103452 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -25,11 +25,11 @@ pub enum Event {
/// The parameter are the (x,y) coords in pixels relative to the top-left corner of the window.
MouseMoved((i32, i32)),
- /// Returns the horizontal and vertical mouse scrolling.
+ /// A mouse wheel or touchpad scroll occurred. Depending on whether the
///
/// A positive value indicates that the wheel was rotated forward, away from the user;
/// a negative value indicates that the wheel was rotated backward, toward the user.
- MouseWheel(f64, f64),
+ MouseWheel(MouseScrollDelta),
/// An event from the mouse has been received.
MouseInput(ElementState, MouseButton),
@@ -57,6 +57,23 @@ pub enum MouseButton {
Other(u8),
}
+#[derive(Debug, Clone, Copy)]
+pub enum MouseScrollDelta {
+ /// Amount in lines or rows to scroll in the horizontal
+ /// and vertical directions.
+ ///
+ /// Positive values indicate movement forward
+ /// (away from the user) or righwards.
+ LineDelta(f32, f32),
+ /// Amount in pixels to scroll in the horizontal and
+ /// vertical direction.
+ ///
+ /// Scroll events are expressed as a PixelDelta if
+ /// supported by the device (eg. a touchpad) and
+ /// platform.
+ PixelDelta(f32, f32)
+}
+
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum VirtualKeyCode {
/// The '1' key over the letters.