Skip to main content

RecognizerContext

Struct RecognizerContext 

Source
pub struct RecognizerContext<'a> {
    pub now: EventTime,
    pub profile: GestureProfile,
    pub local_bounds: Rect,
    pub pointer: PointerInfo,
    pub streak: &'a TapStreak,
}
Expand description

Everything a GestureRecognizer is allowed to know beyond the event in front of it.

Rebuilt per dispatch rather than stored, so a theme change, a density change or a different pointer kind is picked up without touching a single recognizer.

Fields§

§now: EventTime

Now, on the tree’s input timeline. Never Instant::now() — see EventTime.

§profile: GestureProfile

The thresholds for this pointer’s kind. A recognizer reads its slop and its timings from here unless the call site set an explicit override.

§local_bounds: Rect

The owning node’s bounds in its own coordinate space (origin at zero), for a recognizer that needs to know whether the pointer is still inside the target it pressed.

§pointer: PointerInfo

Which pointer produced the event being processed.

§streak: &'a TapStreak

The owning node’s tap streak. Read-only here: it is advanced by the GestureArenaSet that owns it, once per qualifying release, before the recognizers see the event.

Implementations§

Source§

impl<'a> RecognizerContext<'a>

Source

pub fn new( now: EventTime, profile: GestureProfile, local_bounds: Rect, pointer: PointerInfo, ) -> RecognizerContext<'static>

A context with no streak behind it — for a recognizer driven directly rather than through an arena set.

Source

pub fn with_streak<'b>(&self, streak: &'b TapStreak) -> RecognizerContext<'b>

The same context reading streak instead. Used by GestureArenaSet to splice its own streak in without the caller having to own one.

Source

pub fn for_event(event: &RawPointerEvent) -> RecognizerContext<'static>

The context a single mouse event implies, with the shipped mouse profile and no bounds. What GestureArena::process builds for a caller that supplies no node.

Trait Implementations§

Source§

impl<'a> Clone for RecognizerContext<'a>

Source§

fn clone(&self) -> RecognizerContext<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for RecognizerContext<'a>

Source§

impl<'a> Debug for RecognizerContext<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for RecognizerContext<'a>

§

impl<'a> RefUnwindSafe for RecognizerContext<'a>

§

impl<'a> Send for RecognizerContext<'a>

§

impl<'a> Sync for RecognizerContext<'a>

§

impl<'a> Unpin for RecognizerContext<'a>

§

impl<'a> UnsafeUnpin for RecognizerContext<'a>

§

impl<'a> UnwindSafe for RecognizerContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.