Skip to main content

classify_tap

Function classify_tap 

Source
pub fn classify_tap(
    previous: Option<(TapCount, f32, f32)>,
    elapsed_ms: u128,
    x: f32,
    y: f32,
    timeout_ms: u128,
    slop_px: f32,
) -> TapCount
Expand description

Classifies a press into a tap count from the previous tap’s count, the time since it, and the distance from it.

previous is the last tap’s (count, x, y) or None for the first tap. A tap escalates the count (single -> double -> triple, then wraps back to single) only when it lands within both the timeout and the slop radius; otherwise it restarts at a single tap.