Struct Trajectory
pub struct Trajectory { /* private fields */ }Expand description
A pointer’s recent path, newest last.
Implementations§
§impl Trajectory
impl Trajectory
pub fn clear(&mut self)
pub fn clear(&mut self)
Forget the path, e.g. when the pointer leaves the surface or jumps to another display.
pub fn apex(&self) -> Option<Point>
pub fn apex(&self) -> Option<Point>
The apex of the heading cone for the newest sample: the position
APEX_SAMPLES samples before it (the oldest seen, early on).
None before there are two samples.
pub fn recent_origin(&self) -> Option<Point>
pub fn recent_origin(&self) -> Option<Point>
Where the last APEX_SAMPLES samples began: the place a pointer
that has now stopped came from.
pub fn settled(&self, now: Instant) -> bool
pub fn settled(&self, now: Instant) -> bool
Whether the pointer is resting where it is at now: slow at its
newest sample, or silent for SETTLE since. Without motion seen,
it is.
pub fn settle_deadline(&self, now: Instant) -> Option<Instant>
pub fn settle_deadline(&self, now: Instant) -> Option<Instant>
When Self::settled next changes with no further input.
pub fn settling(&self, target: Option<Rect>) -> bool
pub fn settling(&self, target: Option<Rect>) -> bool
Whether the newest sample shows the pointer settling: slow enough to
stop where it is, or decelerating so hard that it will stop inside
target (when given). Without motion seen, the pointer appeared
where it is and is settled.
pub fn comes_to_rest_in(&self, target: Rect) -> bool
pub fn comes_to_rest_in(&self, target: Rect) -> bool
Whether the path ends inside target: slow there already, or
decelerating toward a stop inside it. Unlike Self::settling, a
slow pointer outside the target is not coming to rest in it.
pub fn heading_for(&self, target: Rect) -> bool
pub fn heading_for(&self, target: Rect) -> bool
Whether the newest sample heads for target from outside it: inside
the hull of the apex and the target. A repeated position says
nothing about direction.
pub fn aims_at(&self, target: Rect, now: Instant) -> bool
pub fn aims_at(&self, target: Rect, now: Instant) -> bool
Whether the pointer aims at target at now: on it, and settled or
settling there. The one meaning of “the pointer is on this” for
anything that holds still or pauses for the person.
pub fn rested_in(&self, now: Instant, targets: &[Rect]) -> Option<usize>
pub fn rested_in(&self, now: Instant, targets: &[Rect]) -> Option<usize>
The target in targets the pointer has come to rest in at now:
still for SETTLE inside it, having arrived from outside it. A
throw into a corner ends this way, with no slow sample to read.
pub fn speed_and_peak(&self) -> Option<(f64, f64)>
pub fn speed_and_peak(&self) -> Option<(f64, f64)>
The newest segment’s speed and the peak of the few before it, in
px/ms, over segments at least min_ms long (a burst of samples in
one millisecond reads as that millisecond).
pub fn in_transit(&self, speed: f64, brake_ratio: f64) -> bool
pub fn in_transit(&self, speed: f64, brake_ratio: f64) -> bool
Passing through: at least speed px/ms and not braking (still above
brake_ratio of its recent peak).
Trait Implementations§
§impl Clone for Trajectory
impl Clone for Trajectory
§fn clone(&self) -> Trajectory
fn clone(&self) -> Trajectory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for Trajectory
impl Debug for Trajectory
§impl Default for Trajectory
impl Default for Trajectory
§fn default() -> Trajectory
fn default() -> Trajectory
§impl PartialEq for Trajectory
impl PartialEq for Trajectory
impl StructuralPartialEq for Trajectory
Auto Trait Implementations§
impl Freeze for Trajectory
impl RefUnwindSafe for Trajectory
impl Send for Trajectory
impl Sync for Trajectory
impl Unpin for Trajectory
impl UnsafeUnpin for Trajectory
impl UnwindSafe for Trajectory
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more