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

@ -76,8 +76,7 @@ function cutSelection(mousePosition) {
console.log("Coordinate: start x, y: " + startX + ", " + startY + " end x, y: " + endX + ", " + endY);
// Getting the selected pixels
imageDataToMove = currentLayer.context.getImageData(startX, startY, endX - startX + 1, endY - startY + 1);
clipBoardData = imageDataToMove;
currentLayer.context.clearRect(startX - 0.5, startY - 0.5, endX - startX + 1, endY - startY + 1);
// Moving those pixels from the current layer to the tmp layer
TMPLayer.context.putImageData(imageDataToMove, startX + 1, startY);