Enum dioxus_html::geometry::WheelDelta
source · pub enum WheelDelta {
Pixels(PixelsVector),
Lines(LinesVector),
Pages(PagesVector),
}Expand description
A vector representing the amount the mouse wheel was moved
This may be expressed in Pixels, Lines or Pages
Variants§
Pixels(PixelsVector)
Movement in Pixels
Lines(LinesVector)
Movement in Lines
Pages(PagesVector)
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,
) -> Self
pub fn from_web_attributes( delta_mode: u32, delta_x: f64, delta_y: f64, delta_z: f64, ) -> Self
Construct from the attributes of the web wheel event
sourcepub fn pixels(x: f64, y: f64, z: f64) -> Self
pub fn pixels(x: f64, y: f64, z: f64) -> Self
Convenience function for constructing a WheelDelta with pixel units
sourcepub fn lines(x: f64, y: f64, z: f64) -> Self
pub fn lines(x: f64, y: f64, z: f64) -> Self
Convenience function for constructing a WheelDelta with line units
sourcepub fn pages(x: f64, y: f64, z: f64) -> Self
pub fn pages(x: f64, y: f64, z: f64) -> Self
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 moresource§impl Debug for WheelDelta
impl Debug for WheelDelta
source§impl<'de> Deserialize<'de> for WheelDelta
impl<'de> Deserialize<'de> for WheelDelta
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for WheelDelta
impl PartialEq for WheelDelta
source§fn eq(&self, other: &WheelDelta) -> bool
fn eq(&self, other: &WheelDelta) -> bool
self and other values to be equal, and is used
by ==.source§impl Serialize for WheelDelta
impl Serialize for WheelDelta
impl Copy for WheelDelta
impl StructuralPartialEq for WheelDelta
Auto Trait Implementations§
impl Freeze for WheelDelta
impl RefUnwindSafe for WheelDelta
impl Send for WheelDelta
impl Sync for WheelDelta
impl Unpin for WheelDelta
impl UnwindSafe for WheelDelta
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)