From cd124fe98a0ecf2d1a36a07709b5d47aeebb8b84 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 00:51:43 +0000 Subject: [PATCH] mujma: BUGFIX: Any redo are now working after applying new operation. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41991 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/ImageEditor/ImageHistory.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/javascript/ImageEditor/ImageHistory.js b/javascript/ImageEditor/ImageHistory.js index d4b563fd..f8a94600 100644 --- a/javascript/ImageEditor/ImageHistory.js +++ b/javascript/ImageEditor/ImageHistory.js @@ -19,6 +19,7 @@ ImageHistory = { this.operationMade = ImageHistory.operationMade.bind(this); this.isInHistory = ImageHistory.isInHistory.bind(this); this.onImageLoad = ImageHistory.onImageLoad.bind(this); + this.removeLastOperation = ImageHistory.removeLastOperation.bind(this); this.enable = ImageHistory.enable.bind(this); this.disable = ImageHistory.disable.bind(this); @@ -61,6 +62,8 @@ ImageHistory = { this.historyPointer++; this.size[this.historyPointer] = {'width': imageWidth,'height': imageHeight}; this.history[this.historyPointer] = {'operation': operation,'fileUrl' : url}; + this.size = this.size.slice(0,this.historyPointer+1); + this.history = this.history.slice(0,this.historyPointer+1); if(operation == 'rotate' || operation == 'crop') this.modifiedOriginalImage = true; } }, @@ -100,6 +103,12 @@ ImageHistory = { this.size = new Array(); }, + removeLastOperation: function() { + this.history.pop(); + this.size.pop(); + this.historyPointer--; + }, + isInHistory: function(operation,url) { if(operation == 'initialize' && this.historyPointer != -1) return true; for(var k=0;k