From 6b73fad6db0bc61a4935bec76ebaecf39da366c5 Mon Sep 17 00:00:00 2001 From: Emily Dodds Date: Tue, 11 Oct 2022 12:15:52 -0500 Subject: [PATCH] Fix: Allows user to hit Esc key to cancel Enhanced Editing (#272) Authored-by: Emily Dodds --- .../components/three-fiber/viewpoint/ViewCursorWidget.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scene-composer/src/augmentations/components/three-fiber/viewpoint/ViewCursorWidget.tsx b/packages/scene-composer/src/augmentations/components/three-fiber/viewpoint/ViewCursorWidget.tsx index 1b598e754..6c64d5355 100644 --- a/packages/scene-composer/src/augmentations/components/three-fiber/viewpoint/ViewCursorWidget.tsx +++ b/packages/scene-composer/src/augmentations/components/three-fiber/viewpoint/ViewCursorWidget.tsx @@ -19,12 +19,12 @@ export const ViewCursorWidget = () => { const data = useLoader(SVGLoader, svg.dataUri); const esc = useCallback(() => { - gl.domElement.addEventListener('keyup', (e: KeyboardEvent) => { + window.addEventListener('keyup', (e: KeyboardEvent) => { if (e.key === 'Escape' && !!addingWidget) { setAddingWidget(undefined); } }); - return gl.domElement?.removeEventListener('keyup', setAddingWidget as any); + return window.removeEventListener('keyup', setAddingWidget as any); }, [addingWidget]); const shape = useMemo(() => {