From 7807025b155246f8c33d3fdc1a17ef2c596ac1a1 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 3 May 2024 10:22:50 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8E=98=EC=9D=B8=ED=8A=B8=EC=9B=B9=20?= =?UTF-8?q?=EC=88=98=EC=A0=95(=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=9E=90?= =?UTF-8?q?=EB=A5=B4=EA=B8=B0,=ED=9A=8C=EC=A0=84=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=ED=9B=84=20=EB=B0=9D=EA=B8=B0=20=EC=A1=B0=EC=A0=95=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/libs/fims/paintweb/paintweb.js | 81 ++++++++++--------- .../libs/fims/paintweb/tools/selection.js | 6 +- 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/main/webapp/resources/libs/fims/paintweb/paintweb.js b/src/main/webapp/resources/libs/fims/paintweb/paintweb.js index 6ef35e68..e040c694 100644 --- a/src/main/webapp/resources/libs/fims/paintweb/paintweb.js +++ b/src/main/webapp/resources/libs/fims/paintweb/paintweb.js @@ -1523,11 +1523,13 @@ function PaintWeb (win, doc) { * not. */ this.imageCrop = function (cropX, cropY, cropWidth, cropHeight) { - var bufferCanvas = this.buffer.canvas, - bufferContext = this.buffer.context, - image = this.image, - layerCanvas = this.layer.canvas, - layerContext = this.layer.context; + var orginlCanvas = this.orginl.canvas; + var orginlContext = this.orginl.context; + var bufferCanvas = this.buffer.canvas; + var bufferContext = this.buffer.context; + var layerCanvas = this.layer.canvas; + var layerContext = this.layer.context; + var image = this.image; cropX = parseInt(cropX); cropY = parseInt(cropY); @@ -1594,9 +1596,12 @@ function PaintWeb (win, doc) { layerCanvas.width = cropWidth; layerCanvas.height = cropHeight; + orginlCanvas.width = cropWidth; + orginlCanvas.height = cropHeight; if (layerData && layerContext.putImageData) { layerContext.putImageData(layerData, 0, 0); + orginlContext.putImageData(layerData, 0, 0); } this.stateRestore(layerContext, layerState); @@ -1849,12 +1854,12 @@ function PaintWeb (win, doc) { * * @private */ - this.historyReset = function () { - this.history.pos = 0; - this.history.states = []; - - this.events.dispatch(new appEvent.historyUpdate(0, 0, 0)); - }; + this.historyReset = function () { + this.history.pos = 0; + this.history.states = []; + this.brightnessSliderValue = 0; + this.events.dispatch(new appEvent.historyUpdate(0, 0, 0)); + }; /** * Perform horizontal/vertical line snapping. This method updates the mouse @@ -2491,40 +2496,45 @@ function PaintWeb (win, doc) { }; this.imageRotate = function(clockwise){ - var layerCanvas = _self.layer.canvas, - layerCtx = _self.layer.context, - bufferCanvas = _self.buffer.canvas, - bufferCtx = _self.buffer.context, - img = _self.image; - - var bufferStyle = _self.buffer.canvas.style; + var orginlCanvas = _self.orginl.canvas; + var orginlCtx = _self.orginl.context; + + var layerCanvas = _self.layer.canvas; + var layerCtx = _self.layer.context; var layerStyle = layerCanvas.style; + + var bufferCanvas = _self.buffer.canvas; + var bufferStyle = _self.buffer.canvas.style; + var bufferCtx = _self.buffer.context; + + var img = _self.image; - var srcCanvas = doc.createElement('canvas'); - var srcCtx=srcCanvas.getContext("2d"); + var newCanvas = doc.createElement('canvas'); + var newCtx = newCanvas.getContext("2d"); - srcCanvas.height = layerCanvas.width; - srcCanvas.width = layerCanvas.height; - srcCtx.translate(layerCanvas.height/2,layerCanvas.width/2); + newCanvas.height = layerCanvas.width; + newCanvas.width = layerCanvas.height; + newCtx.translate(layerCanvas.height/2,layerCanvas.width/2); if(clockwise){ - srcCtx.rotate(90*Math.PI/180); + newCtx.rotate(90*Math.PI/180); } else { - srcCtx.rotate(-90*Math.PI/180); + newCtx.rotate(-90*Math.PI/180); } - srcCtx.drawImage(layerCanvas,-layerCanvas.width/2,-layerCanvas.height/2); + newCtx.drawImage(layerCanvas,-layerCanvas.width/2,-layerCanvas.height/2); var lineWidth = bufferCtx.lineWidth; var strokeStyle = bufferCtx.strokeStyle; var fillStyle = bufferCtx.fillStyle; - layerCanvas.width = bufferCanvas.width = srcCanvas.width; - layerCanvas.height = bufferCanvas.height = srcCanvas.height; - bufferCtx.lineWidth = layerCtx.lineWidth = lineWidth; - bufferCtx.strokeStyle = layerCtx.strokeStyle = strokeStyle; - bufferCtx.fillStyle = layerCtx.fillStyle = fillStyle; - - layerCtx.drawImage(srcCanvas, 0, 0); - + orginlCanvas.width = layerCanvas.width = bufferCanvas.width = newCanvas.width; + orginlCanvas.height = layerCanvas.height = bufferCanvas.height = newCanvas.height; + orginlCtx.lineWidth = bufferCtx.lineWidth = layerCtx.lineWidth = lineWidth; + orginlCtx.strokeStyle = bufferCtx.strokeStyle = layerCtx.strokeStyle = strokeStyle; + orginlCtx.fillStyle = bufferCtx.fillStyle = layerCtx.fillStyle = fillStyle; + + layerCtx.drawImage(newCanvas, 0, 0); + orginlCtx.drawImage(newCanvas, 0, 0); + img.width = layerCanvas.width; img.height = layerCanvas.height; @@ -2535,8 +2545,7 @@ function PaintWeb (win, doc) { pw.image.modified = true; - pw.history.pos = 0; - pw.history.states = []; + pw.historyReset(); return true; } diff --git a/src/main/webapp/resources/libs/fims/paintweb/tools/selection.js b/src/main/webapp/resources/libs/fims/paintweb/tools/selection.js index 2cb237d1..27ecaf1d 100644 --- a/src/main/webapp/resources/libs/fims/paintweb/tools/selection.js +++ b/src/main/webapp/resources/libs/fims/paintweb/tools/selection.js @@ -1408,8 +1408,7 @@ pwlib.tools.selection = function (app) { isNumberPlate = false; - app.history.pos = 0; - app.history.states = []; + app.historyReset(); return true; }; @@ -1445,8 +1444,7 @@ pwlib.tools.selection = function (app) { isNumberPlate = true; - app.history.pos = 0; - app.history.states = []; + app.historyReset(); return true; };