pub struct WheelState {
pub status: Status,
pub modifiers: Modifiers,
pub last_wheel_event: f64,
pub unprocessed_wheel_delta: Vec2,
pub smooth_wheel_delta: Vec2,
}Expand description
Keeps track of wheel (scroll) input.
Fields§
§status: StatusAre we currently in a scroll action?
This may be true even if no scroll events came in this frame, but we are in a kinetic scroll or in a smoothed scroll.
modifiers: ModifiersThe modifiers at the start of the scroll.
last_wheel_event: f64Time of the last scroll event.
unprocessed_wheel_delta: Vec2Used for smoothing the scroll delta.
smooth_wheel_delta: Vec2How many points the user scrolled, smoothed over a few frames.
The delta dictates how the content should move.
A positive X-value indicates the content is being moved right, as when swiping right on a touch-screen or track-pad with natural scrolling.
A positive Y-value indicates the content is being moved down, as when swiping down on a touch-screen or track-pad with natural scrolling.
crate::ScrollArea will both read and write to this field, so that
at the end of the frame this will be zero if a scroll-area consumed the delta.
Implementations§
Source§impl WheelState
impl WheelState
pub fn on_wheel_event( &mut self, viewport_rect: Rect, options: &InputOptions, time: f64, unit: MouseWheelUnit, delta: Vec2, phase: TouchPhase, latest_modifiers: Modifiers, )
pub fn after_events(&mut self, time: f64, dt: f32)
Sourcepub fn is_scrolling(&self) -> bool
pub fn is_scrolling(&self) -> bool
True if there is an active scroll action that might scroll more when using Self::smooth_wheel_delta.
pub fn ui(&self, ui: &mut Ui)
Trait Implementations§
Source§impl Clone for WheelState
impl Clone for WheelState
Source§fn clone(&self) -> WheelState
fn clone(&self) -> WheelState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more