diff --git a/js/tools/LassoSelectionTool.js b/js/tools/LassoSelectionTool.js index 1380f7e..7cf2477 100644 --- a/js/tools/LassoSelectionTool.js +++ b/js/tools/LassoSelectionTool.js @@ -29,6 +29,13 @@ class LassoSelectionTool extends SelectionTool { onEnd(mousePos) { super.onEnd(mousePos); + new HistoryState().EditCanvas(); + + this.currentPixels.push[this.startMousePos[0] / currFile.zoom, this.startMousePos[1] / currFile.zoom]; + this.getSelection(); + + // Switch to the move tool so that the user can move the selection + this.switchFunc(this.moveTool); } onSelect() { @@ -46,7 +53,6 @@ class LassoSelectionTool extends SelectionTool { let prevPoint = []; currFile.VFXLayer.context.clearRect(0, 0, currFile.canvasSize[0], currFile.canvasSize[1]); - //currFile.VFXLayer.context.setLineDash([2, 2]); currFile.VFXLayer.context.strokeStyle = 'rgba(0,0,0,1)'; currFile.VFXLayer.context.fillStyle = 'rgba(0,0,0,1)'; currFile.VFXLayer.context.lineWidth = 1; diff --git a/js/tools/MoveSelectionTool.js b/js/tools/MoveSelectionTool.js index 3c81145..7fdc34a 100644 --- a/js/tools/MoveSelectionTool.js +++ b/js/tools/MoveSelectionTool.js @@ -32,8 +32,7 @@ class MoveSelectionTool extends DrawingTool { this.endSelection(); this.currSelection = this.lastCopiedSelection; // Cut the data - currFile.currentLayer.context.clearRect(this.currSelection.left-0.5, this.currSelection.top-0.5, - this.currSelection.width, this.currSelection.height); + this.selectionTool.cutSelection(); } pasteSelection() { @@ -127,47 +126,8 @@ class MoveSelectionTool extends DrawingTool { endSelection() { if (this.currSelection == undefined) return; - // Clearing the tmp (move preview) and vfx (ants) layers - currFile.TMPLayer.context.clearRect(0, 0, currFile.TMPLayer.canvas.width, currFile.TMPLayer.canvas.height); - currFile.VFXLayer.context.clearRect(0, 0, currFile.VFXLayer.canvas.width, currFile.VFXLayer.canvas.height); - - // I have to save the underlying data, so that the transparent pixels in the clipboard - // don't override the coloured pixels in the canvas - let underlyingImageData = currFile.currentLayer.context.getImageData( - this.currSelection.left, this.currSelection.top, - this.currSelection.width+1, this.currSelection.height+1 - ); - let pasteData = this.currSelection.data.data.slice(); - - for (let i=0; i