pub struct ScrollAxis {
pub offset: f32,
pub velocity: f32,
pub content_size: f32,
pub viewport_size: f32,
pub is_dragging: bool,
pub is_coasting: bool,
pub is_bouncing_back: bool,
}Expand description
State machine for a single 1D scrolling dimension (horizontal or vertical).
Fields§
§offset: f32§velocity: f32§content_size: f32§viewport_size: f32§is_dragging: bool§is_coasting: bool§is_bouncing_back: boolImplementations§
Source§impl ScrollAxis
impl ScrollAxis
pub fn new(viewport_size: f32, content_size: f32) -> Self
pub fn max_scroll(&self) -> f32
pub fn can_scroll(&self) -> bool
pub fn scroll_ratio(&self) -> f32
Sourcepub fn handle_drag_delta(&mut self, delta: f32)
pub fn handle_drag_delta(&mut self, delta: f32)
Handles pointer drag movement with rubber-band tension scaling when past boundaries.
Sourcepub fn apply_impulse(&mut self, delta_velocity: f32)
pub fn apply_impulse(&mut self, delta_velocity: f32)
Applies an instantaneous fling or wheel impulse.
Sourcepub fn start_drag(&mut self)
pub fn start_drag(&mut self)
Initiates drag tracking.
Sourcepub fn end_drag(&mut self, release_velocity: f32)
pub fn end_drag(&mut self, release_velocity: f32)
Terminates pointer dragging, transitioning to overscroll spring or inertial coasting.
pub fn is_animating(&self) -> bool
Trait Implementations§
Source§impl Clone for ScrollAxis
impl Clone for ScrollAxis
Source§impl Debug for ScrollAxis
impl Debug for ScrollAxis
Source§impl PartialEq for ScrollAxis
impl PartialEq for ScrollAxis
impl StructuralPartialEq for ScrollAxis
Auto Trait Implementations§
impl Forget for ScrollAxis
impl Freeze for ScrollAxis
impl Move for ScrollAxis
impl RefUnwindSafe for ScrollAxis
impl Send for ScrollAxis
impl Sync for ScrollAxis
impl Unpin for ScrollAxis
impl UnsafeUnpin for ScrollAxis
impl UnwindSafe for ScrollAxis
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
Mutably borrows from an owned value. Read more