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; };