From ec001f66fed8898d6f669ec1e95c663634d085dc Mon Sep 17 00:00:00 2001 From: Balazs Bajorics <2226774+balazsbajorics@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:47:37 +0200 Subject: [PATCH] always call exitPointerLock (#6458) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Problem:** If a scrubbing using the new pointer lock based scrubber control was quick enough, we would often not release the pointer on mouse up – instead leaving you with a hidden cursor until you press Esc. **Fix:** Turns out, `document.pointerLockElement` is still null for a few moments after getting pointer lock, and our code calling `document.exitPointerLock` checks if the pointer lock element is the same as the current control's target. By simply removing the check, we call exitPointerLock() all of the time, making it not brittle anymore. --- editor/src/uuiui/inputs/number-input.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/editor/src/uuiui/inputs/number-input.tsx b/editor/src/uuiui/inputs/number-input.tsx index aeb9d054fee5..3d5b2afc656e 100644 --- a/editor/src/uuiui/inputs/number-input.tsx +++ b/editor/src/uuiui/inputs/number-input.tsx @@ -383,9 +383,7 @@ export const NumberInput = React.memo( const cancelPointerLock = React.useCallback( (revertChanges: 'revert-nothing' | 'revert-changes') => { - if (document.pointerLockElement === pointerOriginRef.current) { - document.exitPointerLock() - } + document.exitPointerLock() if ( revertChanges === 'revert-changes' && onSubmitValue != null &&