Просмотр исходного кода

remove cursor attached node with esc

main
Martin Dørum 4 лет назад
Родитель
Сommit
b838a76a59
1 измененных файлов: 6 добавлений и 7 удалений
  1. 6
    7
      src/CircuitSim.svelte

+ 6
- 7
src/CircuitSim.svelte Просмотреть файл

} }


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();
} }
} }



Загрузка…
Отмена
Сохранить