Skip to main content

TouchState

Struct TouchState 

Source
#[repr(C)]
pub struct TouchState { pub num_touches: usize, pub touch_points: TouchPointVec, pub coalesced_points: TouchPointVec, pub predicted_points: TouchPointVec, }

Fields§

§num_touches: usize

Number of active touch points (kept in sync with touch_points.len()).

§touch_points: TouchPointVec

Currently active touch points (one entry per finger / stylus). Backends update this on touch start / move / end events.

§coalesced_points: TouchPointVec

Intermediate samples the OS captured BETWEEN this frame and the last, oldest first. APPENDED for ABI stability.

A digitizer samples far faster than the display refreshes — 120 Hz or 240 Hz against 60 — and the OS delivers only the newest position per frame, because that is what a button or a scroll view wants. A drawing app wants all of them: a fast stroke rendered from one point per frame is a polyline with visible corners, and the samples that would have rounded it were captured and discarded.

Empty when the platform does not report them, or when nothing moved between frames. The current touch_points entry is NOT repeated here.

§predicted_points: TouchPointVec

Where the OS predicts the touch is about to go, oldest first. APPENDED for ABI stability.

These are EXTRAPOLATIONS, not measurements, and they are wrong as often as the user changes direction. They exist to hide latency: a stroke drawn through them appears to keep up with the finger, and the app discards and redraws them next frame when the real samples arrive. Never persist them — committing a predicted point to a document means committing a guess.

Trait Implementations§

Source§

impl Clone for TouchState

Source§

fn clone(&self) -> TouchState

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 Debug for TouchState

Source§

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

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

impl Default for TouchState

Source§

fn default() -> TouchState

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

impl PartialEq for TouchState

Source§

fn eq(&self, other: &TouchState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TouchState

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.