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
This commit is contained in:
Ingo Schommer 2007-09-16 00:51:43 +00:00
parent 5150e6c6b6
commit cd124fe98a
1 changed files with 9 additions and 0 deletions

View File

@ -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<this.history.length;k++) {