Struct EdgeAim
pub struct EdgeAim { /* private fields */ }Expand description
Reaching for something that waits at a display’s edge (a desk widget’s
quiet form): the same transit-versus-aim reading as HoverIntent,
for targets that are not under the pointer yet.
A sample aims at a target when both hold:
- it heads there: it lies in the convex hull of a recent position and the target, so a pointer moving away or sideways past it does not;
- it is coming to rest there: it is already slow inside the target, or it is decelerating so that, at constant deceleration, it stops inside the target.
A pointer thrown at the edge stops there without slowing first, and the
display then sends no more motion: EdgeAim::rested_in reads that
rest once the pointer has been still for SETTLE inside a target it
arrived at from outside.
A pointer sweeping across or along a target at speed is in transit and aims at nothing, however close it passes; one predicted to run on past the display’s edge is not coming to rest anywhere yet; and one that has not moved aims at nothing either, so a pointer resting near an edge never counts.
The state is pure: every method takes the instant it reasons about.
Implementations§
§impl EdgeAim
impl EdgeAim
pub fn clear(&mut self)
pub fn clear(&mut self)
Forget the trajectory, e.g. when the pointer leaves the display or jumps to another one.
pub fn on_motion(
&mut self,
p: Point,
now: Instant,
targets: &[Rect],
) -> Option<usize>
pub fn on_motion( &mut self, p: Point, now: Instant, targets: &[Rect], ) -> Option<usize>
A pointer sample at p. Returns the index of the target in targets
the pointer is aiming at, the first one when several qualify.
pub fn rested_in(&self, now: Instant, targets: &[Rect]) -> Option<usize>
pub fn rested_in(&self, now: Instant, targets: &[Rect]) -> Option<usize>
The target 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 settled(&self, now: Instant) -> bool
pub fn settled(&self, now: Instant) -> bool
Whether the pointer is resting where it is: slow at its last sample,
or silent for SETTLE since. Without motion seen, it is.
pub fn deadline(&self, now: Instant) -> Option<Instant>
pub fn deadline(&self, now: Instant) -> Option<Instant>
When Self::settled next changes with no further input.
Trait Implementations§
impl StructuralPartialEq for EdgeAim
Auto Trait Implementations§
impl Freeze for EdgeAim
impl RefUnwindSafe for EdgeAim
impl Send for EdgeAim
impl Sync for EdgeAim
impl Unpin for EdgeAim
impl UnsafeUnpin for EdgeAim
impl UnwindSafe for EdgeAim
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