1 /** 2 * Used to undo actions when the canvas is resized 3 * @this {CanvasResizeCommand} 4 * @constructor 5 */ 6 function CanvasResizeCommand(objectId, typeOfObject, property, previousValue, currentValue){ 7 this.objectId = objectId; 8 this.typeOfObject = typeOfObject; 9 this.property = property; 10 this.previousValue = previousValue; 11 this.currentValue = currentValue; 12 this.oType = "Canvas Resize Action"; 13 } 14 15 CanvasResizeCommand.prototype = { 16 /**This method got called every time the Command must execute*/ 17 redo : function(){ 18 this._doAction(this.currentValue); 19 }, 20 21 22 /**This method should be called every time the Command should be undone*/ 23 undo : function(){ 24 this._doAction(this.previousValue); 25 }, 26 27 28 /**This method is a hidden one. 29 *The methods engine should call are only execute() and undo() 30 **/ 31 _doAction:function(value){ 32 Log.info("Property name is: " + this.property + " previous value: " + this.previousValue + " current value: " + this.currentValue); 33 if(this.property == 'Width'){ 34 canvasProps.setWidth(value); 35 } 36 37 if(this.property == 'Height'){ 38 canvasProps.setHeight(value); 39 } 40 41 canvasProps.sync(); 42 setUpEditPanel(canvasProps); 43 } 44 45 } 46 47 48