Clear active tool on escape (#286)
* Clear active tool on escape * Remove console log
This commit is contained in:
parent
862231da4f
commit
1541428ab1
@ -167,13 +167,19 @@ export class App extends React.Component<{}, AppState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private onKeyDown = (event: KeyboardEvent) => {
|
private onKeyDown = (event: KeyboardEvent) => {
|
||||||
if (isInputLike(event.target)) return;
|
|
||||||
|
|
||||||
if (event.key === KEYS.ESCAPE) {
|
if (event.key === KEYS.ESCAPE) {
|
||||||
elements = clearSelection(elements);
|
elements = clearSelection(elements);
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
|
this.setState({ elementType: 'selection' });
|
||||||
|
if (window.document.activeElement instanceof HTMLElement) {
|
||||||
|
window.document.activeElement.blur()
|
||||||
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else if (event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE) {
|
return;
|
||||||
|
}
|
||||||
|
if (isInputLike(event.target)) return;
|
||||||
|
|
||||||
|
if (event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE) {
|
||||||
this.deleteSelectedElements();
|
this.deleteSelectedElements();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else if (isArrowKey(event.key)) {
|
} else if (isArrowKey(event.key)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user