pub struct KineticScrollController {
pub x: ScrollAxis,
pub y: ScrollAxis,
pub last_interaction_time: f32,
pub scrollbar_fade_delay: f32,
pub scrollbar_fade_duration: f32,
}Expand description
Interactive 2D Kinetic Momentum Scroll Controller.
Fields§
§x: ScrollAxis§y: ScrollAxis§last_interaction_time: f32§scrollbar_fade_delay: f32§scrollbar_fade_duration: f32Implementations§
Source§impl KineticScrollController
impl KineticScrollController
pub fn new( viewport_width: f32, viewport_height: f32, content_width: f32, content_height: f32, ) -> Self
pub fn update_dimensions( &mut self, viewport_width: f32, viewport_height: f32, content_width: f32, content_height: f32, )
pub fn scroll_offset(&self) -> (f32, f32)
pub fn set_scroll_offset(&mut self, x: f32, y: f32)
Sourcepub fn on_pointer_down(&mut self, current_time: f32)
pub fn on_pointer_down(&mut self, current_time: f32)
Handles pointer/touch drag start.
Sourcepub fn on_pointer_move(&mut self, dx: f32, dy: f32, current_time: f32)
pub fn on_pointer_move(&mut self, dx: f32, dy: f32, current_time: f32)
Handles pointer/touch drag movement.
Sourcepub fn on_pointer_up(&mut self, vx: f32, vy: f32, current_time: f32)
pub fn on_pointer_up(&mut self, vx: f32, vy: f32, current_time: f32)
Handles pointer/touch release with initial fling velocity (pixels/second).
pub fn is_animating(&self) -> bool
Sourcepub fn scrollbar_opacity(&self, current_time: f32) -> f32
pub fn scrollbar_opacity(&self, current_time: f32) -> f32
Calculates scrollbar opacity [0.0, 1.0] with auto-fadeout after inactivity.
Trait Implementations§
Source§impl Clone for KineticScrollController
impl Clone for KineticScrollController
Source§impl Debug for KineticScrollController
impl Debug for KineticScrollController
Source§impl PartialEq for KineticScrollController
impl PartialEq for KineticScrollController
impl StructuralPartialEq for KineticScrollController
Auto Trait Implementations§
impl Forget for KineticScrollController
impl Freeze for KineticScrollController
impl Move for KineticScrollController
impl RefUnwindSafe for KineticScrollController
impl Send for KineticScrollController
impl Sync for KineticScrollController
impl Unpin for KineticScrollController
impl UnsafeUnpin for KineticScrollController
impl UnwindSafe for KineticScrollController
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