Ability to cancel nodes implemented

This commit is contained in:
barsdeveloper
2021-12-12 22:00:41 +01:00
parent 59eb68298c
commit 43439bbcd3
6 changed files with 728 additions and 629 deletions

14
js/input/KeyboardCanc.js Normal file
View File

@@ -0,0 +1,14 @@
import KeyboardShortcut from "./KeyboardShortcut";
export default class KeyvoardCanc extends KeyboardShortcut {
constructor(target, blueprint, options = {}) {
options.key = "Delete"
super(target, blueprint, options)
}
fire() {
this.blueprint.deleteNode(...this.blueprint.getNodes(true))
}
}

View File

@@ -2,7 +2,7 @@ import Context from "./Context"
export default class KeyboardShortcut extends Context {
constructor(target, blueprint, options) {
constructor(target, blueprint, options = {}) {
options.wantsFocusCallback = true
super(target, blueprint, options)
@@ -15,7 +15,6 @@ export default class KeyboardShortcut extends Context {
let self = this
this.keyDownHandler = e => {
e.preventDefault()
if (
e.code == self.key
&& e.ctrlKey === self.ctrlKey

View File

@@ -86,7 +86,7 @@ export default class MouseClickDrag extends Pointing {
this.target.removeEventListener("mousedown", this.mouseDownHandler)
if (this.clickButton == 2) {
this.target.removeEventListener("contextmenu", this.preventDefault)
} blueprintunfocusHandler
}
}
/* Subclasses will override the following methods */