Skip to content

Instantly share code, notes, and snippets.

@rodp
Created March 19, 2012 11:12
Show Gist options
  • Save rodp/2107880 to your computer and use it in GitHub Desktop.
Save rodp/2107880 to your computer and use it in GitHub Desktop.
Google I/O game pendulum fix
/*
I wanted to use the Pendulum tool in Google's I/O game
(https://developers.google.com/events/io/input-output)
but it was broken.
To fix it, run this in Chrome's JS console once the game is loaded.
*/
myRoot.PendulumEditorView = function(c){function b(){b.__super__.constructor.apply(this,arguments)}__extends(b,c);b.className="PendulumEditorView";b.prototype.adjustScale=function(a){var c,f,d,g,h,i,j,l=this;b.__super__.adjustScale.apply(this,arguments);d=this.componentObject.getRadius();c=a-d;this.componentObject.setRadius(a);this.componentObject.setPosition(this.componentObject.getPosition().subtract(newPoint(c,c)),true);g=this.outerControls.concat(this.colorControls).concat([this.scaleControl]);f=1;j=[];h=0;for(i=g.length;h<
i;h++){c=g[h];j.push(function(b){if(b===l.colorControl||__indexOf.call(l.colorControls,b)>=0)b.angle=l.getColorControlAngle(f++);return b.distance=b.distance-d+a}(c))}return j};b.prototype.adjustRotation=function(a){var c;c=this.componentObject.getRotation();b.__super__.adjustRotation.apply(this,arguments);return this.scaleControl.angle=this.scaleControl.angle-c+a};b.prototype.adjustScaleAndRotation=function(a,c){this.adjustRotation(c);70<=a&&a<=250&&this.adjustScale(a);return b.__super__.adjustScaleAndRotation.apply(this,
arguments)};return b}(ComponentEditorView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment