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: EventTimeNow, on the tree’s input timeline. Never Instant::now() — see
EventTime.
profile: GestureProfileThe 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: RectThe 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: PointerInfoWhich pointer produced the event being processed.
streak: &'a TapStreakThe 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>
impl<'a> RecognizerContext<'a>
Sourcepub fn new(
now: EventTime,
profile: GestureProfile,
local_bounds: Rect,
pointer: PointerInfo,
) -> RecognizerContext<'static>
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.
Sourcepub fn with_streak<'b>(&self, streak: &'b TapStreak) -> RecognizerContext<'b>
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.
Sourcepub fn for_event(event: &RawPointerEvent) -> RecognizerContext<'static>
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>
impl<'a> Clone for RecognizerContext<'a>
Source§fn clone(&self) -> RecognizerContext<'a>
fn clone(&self) -> RecognizerContext<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more