mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 00:58:13 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user