Created
March 13, 2013 14:06
Revisions
-
unstoppablecarl created this gist
Mar 13, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ updateSize: function(width, height){ // get current center var centerX = this.pos.x + this.size.x/2, centerY = this.pos.y + this.size.y/2; // set new width / height this.size.x = width; this.size.y = height; // make the center coord match what it was previously this.pos.x = centerX - this.size.x/2; this.pos.y = centerY - this.size.y/2; }