Expand description
Hover jitter stabilization using CUSUM change-point detection.
Eliminates hover flicker when the pointer jitters around widget boundaries while maintaining responsiveness for intentional target changes.
§Algorithm
The stabilizer uses a simplified CUSUM (Cumulative Sum) change-point detector:
- Track signed distance
d_tto current target boundary (positive = inside) - Compute cumulative sum:
S_t = max(0, S_{t-1} + d_t - k)wherekis drift allowance - Switch target only when
S_t > h(threshold) indicating strong evidence of intent
A hysteresis band around boundaries prevents oscillation from single-cell jitter.
§Invariants
- Hover target only changes when evidence exceeds threshold
- Single-cell jitter sequences do not cause target flicker
- Intentional crossing (steady motion) triggers switch within ~2 frames
- No measurable overhead (<2%) on hit-test pipeline
§Failure Modes
- If hit-test returns None consistently, stabilizer holds last known target
- If threshold is too high, responsiveness degrades (tune via config)
- If drift allowance is too low, jitter causes accumulation (tune k parameter)
§Evidence Ledger
In debug mode, the stabilizer logs:
- CUSUM score at each update
- Hysteresis state (inside band vs. outside)
- Target switch events with evidence values
Structs§
- Hover
Stabilizer - Stateful hover stabilizer that prevents jitter-induced target flicker.
- Hover
Stabilizer Config - Configuration for hover jitter stabilization.