Skip to main content

GestureProgress

Struct GestureProgress 

Source
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: f64

X of the first finger when the sequence began.

§start_y: f64

Y of the first finger when the sequence began.

§last_x: f64

X of the most recently seen position of the first finger.

§last_y: f64

Y of the most recently seen position of the first finger.

§travel: f64

Accumulated path length in CSS pixels.

§pinch_start_distance: f64

Distance between the two fingers when a pinch began.

§started_at: f64

Timestamp of touchstart, in milliseconds.

§active: bool

Whether a sequence is currently being tracked.

Implementations§

Source§

impl GestureProgress

Source

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 at touchstart.
Source

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 at touchmove.
Source

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, or None when no sequence is in flight.
Source

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, or None when no sequence was in flight.
Source

pub fn reset(&mut self)

Clears all progress, used when a sequence is cancelled.

§Arguments
Source§

impl GestureProgress

Source

pub fn get_start_x(&self) -> f64

Source

pub fn get_mut_start_x(&mut self) -> &mut f64

Source

pub fn set_start_x(&mut self, val: f64) -> &mut Self

Source

pub fn get_start_y(&self) -> f64

Source

pub fn get_mut_start_y(&mut self) -> &mut f64

Source

pub fn set_start_y(&mut self, val: f64) -> &mut Self

Source

pub fn get_last_x(&self) -> f64

Source

pub fn get_mut_last_x(&mut self) -> &mut f64

Source

pub fn set_last_x(&mut self, val: f64) -> &mut Self

Source

pub fn get_last_y(&self) -> f64

Source

pub fn get_mut_last_y(&mut self) -> &mut f64

Source

pub fn set_last_y(&mut self, val: f64) -> &mut Self

Source

pub fn get_travel(&self) -> &f64

Source

pub fn get_mut_travel(&mut self) -> &mut f64

Source

pub fn set_travel(&mut self, val: f64) -> &mut Self

Source

pub fn get_pinch_start_distance(&self) -> f64

Source

pub fn get_mut_pinch_start_distance(&mut self) -> &mut f64

Source

pub fn set_pinch_start_distance(&mut self, val: f64) -> &mut Self

Source

pub fn get_started_at(&self) -> f64

Source

pub fn get_mut_started_at(&mut self) -> &mut f64

Source

pub fn set_started_at(&mut self, val: f64) -> &mut Self

Source

pub fn get_active(&self) -> bool

Source

pub fn get_mut_active(&mut self) -> &mut bool

Source

pub fn set_active(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Clone for GestureProgress

Source§

fn clone(&self) -> Self

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 Copy for GestureProgress

Source§

impl Debug for GestureProgress

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for GestureProgress

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more