From c3e9f775e7e90d454cf719fd1bcab96cace86360 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 26 Jan 2020 02:36:05 -0800 Subject: [PATCH] Disable escape when creating element (#576) Problem: - Select arrow - Mouse down somewhere - Mouse move somewhere to create an arrow - Press escape - Now you're in a weird situation where the shape is now "selection" but you're still dragging the arrow. If you mouse up, the arrow disappears In order to solve this problem, we can avoid making escape do anything if you're currently dragging an element --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 2108deb6..f0d93627 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -284,7 +284,7 @@ export class App extends React.Component { }; private onKeyDown = (event: KeyboardEvent) => { - if (event.key === KEYS.ESCAPE) { + if (event.key === KEYS.ESCAPE && !this.state.draggingElement) { elements = clearSelection(elements); this.forceUpdate(); this.setState({ elementType: "selection" });