mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Ability to cancel nodes implemented
This commit is contained in:
14
js/input/KeyboardCanc.js
Normal file
14
js/input/KeyboardCanc.js
Normal 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))
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user