From f5f7f3726065f5cff53bca23a52a794d3bed72e5 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Wed, 8 Feb 2023 15:58:14 +0100 Subject: [PATCH] change(tracker): tune shake check --- tracker/tracker/src/main/modules/mouse.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tracker/tracker/src/main/modules/mouse.ts b/tracker/tracker/src/main/modules/mouse.ts index 7ed64f1c4..c94f117fa 100644 --- a/tracker/tracker/src/main/modules/mouse.ts +++ b/tracker/tracker/src/main/modules/mouse.ts @@ -112,7 +112,7 @@ export default function (app: App): void { let directionChangeCount = 0 let distance = 0 let checkIntervalId: NodeJS.Timer - const shakeThreshold = 0.005 + const shakeThreshold = 0.008 const shakeCheckInterval = 225 function checkMouseShaking() { @@ -124,7 +124,7 @@ export default function (app: App): void { } const acceleration = (nextVelocity - velocity) / shakeCheckInterval - if (directionChangeCount && acceleration > shakeThreshold) { + if (directionChangeCount > 3 && acceleration > shakeThreshold) { console.log('Mouse shake detected!') }