From 87e2a1ceb8a2026f63f08bffdbc073274976600a Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Wed, 16 Oct 2024 11:38:41 +0300 Subject: [PATCH] fix: Movement jumps on windows (#4296) ## Description Seems like closes #4236 For me bug on windows looks a little bit different like a huge scrubbing jumps. But anyway seems like fixed everything described in corresponding issue. ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file --- .../src/components/primitives/numeric-gesture-control.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/design-system/src/components/primitives/numeric-gesture-control.ts b/packages/design-system/src/components/primitives/numeric-gesture-control.ts index 69b51987a2..7f5d68888a 100644 --- a/packages/design-system/src/components/primitives/numeric-gesture-control.ts +++ b/packages/design-system/src/components/primitives/numeric-gesture-control.ts @@ -287,7 +287,8 @@ const requestPointerLock = ( // other browsers show a warning banner, making the use of it in this scenario subpar: in which case we fallback to using non-pointerLock means: // albeit without an infinite cursor ux. if (shouldUsePointerLock) { - targetNode.requestPointerLock(); + // @ts-expect-error - unadjustedMovement is a chromium only feature, fixes random movementX|Y jumps on windows + targetNode.requestPointerLock({ unadjustedMovement: true }); const cursorNode = (targetNode.ownerDocument.querySelector( "#numeric-guesture-control-cursor" ) ||