Handle escape keybinding (#49)
This commit is contained in:
parent
0d75b78374
commit
8a43ed691d
@ -374,10 +374,14 @@ class App extends React.Component<{}, AppState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private onKeyDown = (event: KeyboardEvent) => {
|
private onKeyDown = (event: KeyboardEvent) => {
|
||||||
if (
|
if ((event.target as HTMLElement).nodeName === "INPUT") {
|
||||||
event.key === "Backspace" &&
|
return;
|
||||||
(event.target as HTMLElement).nodeName !== "INPUT"
|
}
|
||||||
) {
|
|
||||||
|
if (event.key === "Escape") {
|
||||||
|
clearSelection();
|
||||||
|
drawScene();
|
||||||
|
} else if (event.key === "Backspace") {
|
||||||
deleteSelectedElements();
|
deleteSelectedElements();
|
||||||
drawScene();
|
drawScene();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user