#[repr(C)]pub struct TouchState {
pub num_touches: usize,
pub touch_points: TouchPointVec,
pub coalesced_points: TouchPointVec,
pub predicted_points: TouchPointVec,
}Fields§
§num_touches: usizeNumber of active touch points (kept in sync with touch_points.len()).
touch_points: TouchPointVecCurrently active touch points (one entry per finger / stylus). Backends update this on touch start / move / end events.
coalesced_points: TouchPointVecIntermediate 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: TouchPointVecWhere 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
impl Clone for TouchState
Source§fn clone(&self) -> TouchState
fn clone(&self) -> TouchState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more