pub struct VelocityTracker { /* private fields */ }Expand description
A rolling history of pointer positions that can be asked for a velocity.
Adding a position is cheap; asking for the estimate is not free (the regression strategy solves a small system), so ask once, at the release.
Implementations§
Source§impl VelocityTracker
impl VelocityTracker
Sourcepub fn new(strategy: VelocityStrategy) -> Self
pub fn new(strategy: VelocityStrategy) -> Self
A tracker using strategy.
Sourcepub fn strategy(&self) -> VelocityStrategy
pub fn strategy(&self) -> VelocityStrategy
The strategy in force.
Sourcepub fn add_position(&mut self, time: f32, point: Point)
pub fn add_position(&mut self, time: f32, point: Point)
Records where the pointer was, and when (in seconds).
Sourcepub fn estimate(&self, now: f32) -> Option<VelocityEstimate>
pub fn estimate(&self, now: f32) -> Option<VelocityEstimate>
The estimate as of now (seconds, same clock as the samples), or None
when not a single position has been recorded.
Sourcepub fn velocity(&self, now: f32) -> Velocity
pub fn velocity(&self, now: f32) -> Velocity
The estimated velocity as of now, or Velocity::ZERO if there is
nothing to go on.
Trait Implementations§
Source§impl Clone for VelocityTracker
impl Clone for VelocityTracker
Source§impl Debug for VelocityTracker
impl Debug for VelocityTracker
Source§impl Default for VelocityTracker
impl Default for VelocityTracker
Source§fn default() -> Self
fn default() -> Self
The base tracker, a fitted curve (VelocityStrategy::Regression). Which one a
scroll reads its flings with is its scroll behaviour’s choice (milestone 616).
Auto Trait Implementations§
impl Freeze for VelocityTracker
impl RefUnwindSafe for VelocityTracker
impl Send for VelocityTracker
impl Sync for VelocityTracker
impl Unpin for VelocityTracker
impl UnsafeUnpin for VelocityTracker
impl UnwindSafe for VelocityTracker
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