Continued cut -> paste implementation

There's only a bug, when pasting consecutively, every time it cuts the area again. There's probably some weird cut call somewhere.
This commit is contained in:
unsettledgames
2020-04-20 19:26:00 +02:00
parent 944cf1fbed
commit 12e43e0449
5 changed files with 65 additions and 15 deletions

View File

@ -58,8 +58,11 @@ class Tool {
tools[i].classList.remove("selected");
}
//give the button of the selected tool the .selected class
document.getElementById(this.name+"-button").parentNode.classList.add("selected");
let buttonNode = document.getElementById(this.name + "-button");
//give the button of the selected tool the .selected class if the tool has a button
if(buttonNode != null && buttonNode.parentNode != null) {
document.getElementById(this.name+"-button").parentNode.classList.add("selected");
}
//change cursor
this.updateCursor();