Skip to content

Commit

Permalink
Fix: Allows user to hit Esc key to cancel Enhanced Editing (#272)
Browse files Browse the repository at this point in the history
Authored-by: Emily Dodds <dodemily@amazon.com>
  • Loading branch information
mumanity committed Oct 11, 2022
1 parent 58b70bd commit 9c1b9e6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 9c1b9e6

Please sign in to comment.