Desktop: Port the pointer shake event detection for direct input routing (#4506)

Desktop: Port shake detection for direct input routing
This commit is contained in:
Timon
2026-09-06 10:42:20 +00:00
committed by GitHub
parent d2bf8f99d2
commit f11e6f3bc6
2 changed files with 80 additions and 10 deletions
+1
View File
@@ -303,6 +303,7 @@ function pointerAttributes(e: PointerEvent): [number, number | undefined, number
return [e.timeStamp, isPen ? e.pressure : undefined, isPen ? e.tiltX : undefined, isPen ? e.tiltY : undefined, isPen ? e.twist : undefined, isPen ? e.tangentialPressure : undefined, eraser];
}
// Keep heuristic and constants in sync with `ShakeTracker` in `desktop/src/input.rs`.
function detectShake(e: PointerEvent | MouseEvent): boolean {
const SENSITIVITY_DIRECTION_CHANGES = 3;
const SENSITIVITY_DISTANCE_TO_DISPLACEMENT_RATIO = 0.1;