| } | } | ||||
| onKeyDown(key) { | onKeyDown(key) { | ||||
| let responded = true; | |||||
| if (key == "Escape" || key == "q") { | if (key == "Escape" || key == "q") { | ||||
| this.tooltip = null; | this.tooltip = null; | ||||
| this.selectedNodes = []; | this.selectedNodes = []; | ||||
| this.mouseMoveStart = null; | this.mouseMoveStart = null; | ||||
| this.currentLink = null; | this.currentLink = null; | ||||
| this.selection = null; | this.selection = null; | ||||
| if (this.cursorAttachedNode != null) { | |||||
| this.deleteNode(this.cursorAttachedNode); | |||||
| this.cursorAttachedNode = null; | |||||
| } | |||||
| this.requestFrame(); | this.requestFrame(); | ||||
| } else if (key == "Delete") { | } else if (key == "Delete") { | ||||
| for (let node of this.selectedNodes) { | for (let node of this.selectedNodes) { | ||||
| this.requestFrame(); | this.requestFrame(); | ||||
| } | } | ||||
| } | } | ||||
| } else { | |||||
| responded = false; | |||||
| } | |||||
| if (responded) { | |||||
| evt.preventDefault(); | |||||
| } | } | ||||
| } | } | ||||