pub enum WheelDelta {
Pixels(Vector3D<f64, Pixels>),
Lines(Vector3D<f64, Lines>),
Pages(Vector3D<f64, Pages>),
}
Expand description
A vector representing the amount the mouse wheel was moved
This may be expressed in Pixels, Lines or Pages
Variants§
Pixels(Vector3D<f64, Pixels>)
Movement in Pixels
Lines(Vector3D<f64, Lines>)
Movement in Lines
Pages(Vector3D<f64, Pages>)
Movement in Pages
Implementations§
Source§impl WheelDelta
impl WheelDelta
Sourcepub fn from_web_attributes(
delta_mode: u32,
delta_x: f64,
delta_y: f64,
delta_z: f64,
) -> WheelDelta
pub fn from_web_attributes( delta_mode: u32, delta_x: f64, delta_y: f64, delta_z: f64, ) -> WheelDelta
Construct from the attributes of the web wheel event
Sourcepub fn pixels(x: f64, y: f64, z: f64) -> WheelDelta
pub fn pixels(x: f64, y: f64, z: f64) -> WheelDelta
Convenience function for constructing a WheelDelta with pixel units
Sourcepub fn lines(x: f64, y: f64, z: f64) -> WheelDelta
pub fn lines(x: f64, y: f64, z: f64) -> WheelDelta
Convenience function for constructing a WheelDelta with line units
Sourcepub fn pages(x: f64, y: f64, z: f64) -> WheelDelta
pub fn pages(x: f64, y: f64, z: f64) -> WheelDelta
Convenience function for constructing a WheelDelta with page units
Sourcepub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Returns true iff there is no wheel movement
i.e. the x, y and z delta is zero (disregards units)
Sourcepub fn strip_units(&self) -> Vector3D<f64, UnknownUnit>
pub fn strip_units(&self) -> Vector3D<f64, UnknownUnit>
A Vector3D proportional to the amount scrolled
Note that this disregards the 3 possible units: this could be expressed in terms of pixels, lines, or pages.
In most cases, to properly handle scrolling, you should handle all 3 possible enum variants instead of stripping units. Otherwise, if you assume that the units will always be pixels, the user may experience some unexpectedly slow scrolling if their mouse/OS sends values expressed in lines or pages.
Trait Implementations§
Source§impl Clone for WheelDelta
impl Clone for WheelDelta
Source§fn clone(&self) -> WheelDelta
fn clone(&self) -> WheelDelta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more