Skip to main content

classify_tap_count

Function classify_tap_count 

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

Classifies a press into a 1-based 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 increments the count only when it lands within both the timeout and the slop radius; otherwise it restarts at 1. The count is not wrapped here — the granularity mapping (tap_selection_granularity) cycles instead, so the field can keep escalating (word → line → paragraph → word …) as long as the finger keeps tapping in place.