Browse Source

remove cursor attached node with esc

main
Martin Dørum 2 years ago
parent
commit
b838a76a59
1 changed files with 6 additions and 7 deletions
  1. 6
    7
      src/CircuitSim.svelte

+ 6
- 7
src/CircuitSim.svelte View File

@@ -143,13 +143,18 @@
}

onKeyDown(key) {
let responded = true;
if (key == "Escape" || key == "q") {
this.tooltip = null;
this.selectedNodes = [];
this.mouseMoveStart = null;
this.currentLink = null;
this.selection = null;

if (this.cursorAttachedNode != null) {
this.deleteNode(this.cursorAttachedNode);
this.cursorAttachedNode = null;
}

this.requestFrame();
} else if (key == "Delete") {
for (let node of this.selectedNodes) {
@@ -163,12 +168,6 @@
this.requestFrame();
}
}
} else {
responded = false;
}

if (responded) {
evt.preventDefault();
}
}


Loading…
Cancel
Save