Implement cut tool

yeah that was the easy part but still

- Added hotkeys for copy, paste and cut
- Added _copyPaste.js for copy, cut and paste management
This commit is contained in:
unsettledgames
2020-04-20 16:55:34 +02:00
parent f1fe597b80
commit 944cf1fbed
8 changed files with 69 additions and 9 deletions

21
js/_copyPaste.js Normal file
View File

@ -0,0 +1,21 @@
let clipboardData;
function copySelection() {
}
function pasteSelection() {
imageDataToMove = clipboardData;
updateMovePreview();
}
function cutSelectionTool() {
// Getting the selected pixels
clipBoardData = currentLayer.context.getImageData(startX, startY, endX - startX + 1, endY - startY + 1);
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);
//originalDataPosition = [currentPos[0], currentPos[1]];
}