pub struct HardScroller {
pub position: f32,
pub scale: f32,
}Expand description
Direct scroll offset without momentum.
Fields§
§position: f32Current scroll offset on this axis.
scale: f32Multiplier applied to scroll deltas.
Implementations§
Source§impl HardScroller
impl HardScroller
Sourcepub fn direct_set_position(&mut self, position: f32)
pub fn direct_set_position(&mut self, position: f32)
Sets the scroll position directly.
Sourcepub fn update(&mut self, d_scroll: f32, _dt: f32)
pub fn update(&mut self, d_scroll: f32, _dt: f32)
Applies a scroll delta for one frame.
§Examples
use cotis_interactivity::scroll::HardScroller;
let mut scroller = HardScroller::new(1.0);
scroller.update(5.0, 0.0);
assert_eq!(scroller.get_position(), 5.0);Sourcepub fn get_position(&self) -> f32
pub fn get_position(&self) -> f32
Returns the current scroll offset.
Trait Implementations§
Source§impl Clone for HardScroller
impl Clone for HardScroller
Source§fn clone(&self) -> HardScroller
fn clone(&self) -> HardScroller
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for HardScroller
Auto Trait Implementations§
impl Freeze for HardScroller
impl RefUnwindSafe for HardScroller
impl Send for HardScroller
impl Sync for HardScroller
impl Unpin for HardScroller
impl UnsafeUnpin for HardScroller
impl UnwindSafe for HardScroller
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