pub struct GestureProgress {
pub start_x: f64,
pub start_y: f64,
pub last_x: f64,
pub last_y: f64,
pub travel: f64,
pub pinch_start_distance: f64,
pub started_at: f64,
pub active: bool,
}Expand description
Per-touch progress for one in-flight gesture sequence.
This is deliberately not a signal: it changes on every touchmove and
nothing in a view should re-render until a gesture actually completes.
Fields§
§start_x: f64X of the first finger when the sequence began.
start_y: f64Y of the first finger when the sequence began.
last_x: f64X of the most recently seen position of the first finger.
last_y: f64Y of the most recently seen position of the first finger.
travel: f64Accumulated path length in CSS pixels.
pinch_start_distance: f64Distance between the two fingers when a pinch began.
started_at: f64Timestamp of touchstart, in milliseconds.
active: boolWhether a sequence is currently being tracked.
Implementations§
Source§impl GestureProgress
impl GestureProgress
Sourcepub fn begin(&mut self, points: &[NativeTouchPoint])
pub fn begin(&mut self, points: &[NativeTouchPoint])
Records the origin of a new touch sequence.
When two or more fingers land together, the inter-finger distance is captured as the pinch baseline, so a later spread is measured against the initial separation rather than against zero.
§Arguments
&[NativeTouchPoint]- The touch points active attouchstart.
Sourcepub fn advance(&mut self, points: &[NativeTouchPoint])
pub fn advance(&mut self, points: &[NativeTouchPoint])
Folds a touchmove reading into the running totals.
Travel is measured segment by segment rather than from the origin so that a finger drawing a closed loop accumulates a large distance, which is what separates a drag from a wandering tap.
§Arguments
&[NativeTouchPoint]- The touch points active attouchmove.
Sourcepub fn primary(&self) -> Option<GesturePoint>
pub fn primary(&self) -> Option<GesturePoint>
Returns the first tracked finger, or None when no sequence is
active.
§Returns
Option<GesturePoint>- The live position of the tracked finger, orNonewhen no sequence is in flight.
Sourcepub fn finish(&mut self, config: &EuvGestureConfig) -> Option<EuvGesture>
pub fn finish(&mut self, config: &EuvGestureConfig) -> Option<EuvGesture>
Classifies the finished sequence and marks the cell inactive.
A tap requires both a small straight-line displacement and a short accumulated path. Checking only the displacement would misread a finger that traces a closed loop and returns to its origin as a tap, even though it travelled hundreds of pixels; the path length is what separates the two cases.
§Arguments
&EuvGestureConfig- The thresholds to classify against.
§Returns
Option<EuvGesture>- The recognised gesture, orNonewhen no sequence was in flight.