Skip to main content

pointer_types/
wheel.rs

1use dpi::PhysicalPosition;
2
3#[derive(Clone, Copy, Debug, PartialEq)]
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5pub struct WheelEvent {
6  delta: MouseScrollDelta,
7}
8
9/// Describes a difference in the mouse scroll wheel state.
10#[derive(Clone, Copy, Debug, PartialEq)]
11#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
12pub enum MouseScrollDelta {
13  /// Amount in lines or rows to scroll in the horizontal
14  /// and vertical directions.
15  ///
16  /// Positive values indicate that the content that is being scrolled should move
17  /// right and down (revealing more content left and up).
18  LineDelta(f32, f32),
19
20  /// Amount in pixels to scroll in the horizontal and
21  /// vertical direction.
22  ///
23  /// Scroll events are expressed as a `PixelDelta` if
24  /// supported by the device (eg. a touchpad) and
25  /// platform.
26  ///
27  /// Positive values indicate that the content being scrolled should
28  /// move right/down.
29  ///
30  /// For a 'natural scrolling' touch pad (that acts like a touch screen)
31  /// this means moving your fingers right and down should give positive values,
32  /// and move the content right and down (to reveal more things left and up).
33  PixelDelta(PhysicalPosition<f64>),
34}