Skip to content

Commit

Permalink
fixed a bug with the zoom toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe committed Apr 17, 2012
1 parent d15c2a1 commit 142bb61
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions skybrush/js/skybrush.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3549,6 +3549,7 @@
* and 'undo' methods on the CanvasManager. * and 'undo' methods on the CanvasManager.
* *
* @param name The name of the action to perform, 'undo' or 'redo'. * @param name The name of the action to perform, 'undo' or 'redo'.
* @return True if the action is performed, otherwise false.
*/ */
CanvasManager.prototype.undoRedo = function( name ) { CanvasManager.prototype.undoRedo = function( name ) {
var canvas = this.undos[name](); var canvas = this.undos[name]();
Expand All @@ -3568,9 +3569,11 @@
this.refreshUpscale(); this.refreshUpscale();
} }
} ); } );
}


return this; return true;
} else {
return false;
}
}; };


/** /**
Expand Down Expand Up @@ -3824,23 +3827,22 @@
}; };


/** /**
* * @return True if an undo was performed, otherwise false.
*/ */
CanvasManager.prototype.redo = function() { CanvasManager.prototype.redo = function() {
this.undoRedo( 'redo' ); return this.undoRedo( 'redo' );
} }


/** /**
* * @return True if an undo was performed, otherwise false.
*/ */
CanvasManager.prototype.undo = function() { CanvasManager.prototype.undo = function() {
if ( this.copyObj.hasPaste() ) { if ( this.copyObj.hasPaste() ) {
this.clearPaste(); this.clearPaste();
return true;
} else { } else {
this.undoRedo( 'undo' ); return this.undoRedo( 'undo' );
} }

return this;
}; };


/** /**
Expand Down Expand Up @@ -5768,7 +5770,6 @@
field: 'zoomOut', field: 'zoomOut',
type : 'toggle', type : 'toggle',


css_options : [ 'skybrush_top_bar_zoom_in', 'skybrush_top_bar_zoom_out' ],
name_options: [ 'In' , 'Out' ], name_options: [ 'In' , 'Out' ],


callback: function() { callback: function() {
Expand Down Expand Up @@ -8462,7 +8463,7 @@


if ( zoom !== this.getZoom() || force ) { if ( zoom !== this.getZoom() || force ) {
this.canvas.setZoom( zoom, x, y ); this.canvas.setZoom( zoom, x, y );
this.events.run( 'onZoom', zoom ); this.events.run( 'onZoom', zoom, x, y );
} }


return this; return this;
Expand Down Expand Up @@ -8959,15 +8960,17 @@
}; };


SkyBrush.prototype.undo = function() { SkyBrush.prototype.undo = function() {
this.canvas.undo(); if ( this.canvas.undo() ) {
this.events.run( 'onundo'); this.events.run( 'onundo' );
}


return this; return this;
}; };


SkyBrush.prototype.redo = function() { SkyBrush.prototype.redo = function() {
this.canvas.redo(); if ( this.canvas.redo() ) {
this.events.run( 'onredo'); this.events.run( 'onredo' );
}


return this; return this;
}; };
Expand Down

0 comments on commit 142bb61

Please sign in to comment.