diff --git a/js/_getCursorPosition.js b/js/_getCursorPosition.js index 9a0d1d1..0452e16 100644 --- a/js/_getCursorPosition.js +++ b/js/_getCursorPosition.js @@ -12,8 +12,8 @@ function getCursorPosition(e) { y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } - x -= canvas.offsetLeft; - y -= canvas.offsetTop; + x -= currentLayer.canvas.offsetLeft; + y -= currentLayer.canvas.offsetTop; return [Math.round(x), Math.round(y)]; } \ No newline at end of file diff --git a/js/_history.js b/js/_history.js index f1dad5c..017d451 100644 --- a/js/_history.js +++ b/js/_history.js @@ -3,6 +3,35 @@ var redoStates = []; const undoLogStyle = 'background: #87ff1c; color: black; padding: 5px;'; +function HistoryStateResizeCanvas(newSize, oldSize, imageDatas) { + this.oldSize = oldSize; + this.newSize = newSize; + this.imageDatas = imageDatas; + + this.undo = function() { + let dataIndex = 0; + console.log("breakpoint"); + // Resizing the canvas + resizeCanvas(null, oldSize); + // Putting the image datas + for (let i=0; i