Merge pull request #138 from CartoDB/onesteppause

Makes sure that animation is paused when steps === one
This commit is contained in:
Francisco Dans 2015-03-02 17:19:43 +01:00
commit 6ba2e42625

View File

@ -46,6 +46,9 @@ var cancelAnimationFrame = global.cancelAnimationFrame
this.running = true; this.running = true;
requestAnimationFrame(this._tick); requestAnimationFrame(this._tick);
this.options.onStart && this.options.onStart(); this.options.onStart && this.options.onStart();
if(this.options.steps === 1){
this.running = false;
}
}, },
isRunning: function() { isRunning: function() {
@ -80,6 +83,7 @@ var cancelAnimationFrame = global.cancelAnimationFrame
this.range = torque.math.linear(0, this.options.steps); this.range = torque.math.linear(0, this.options.steps);
this.rangeInv = this.range.invert(); this.rangeInv = this.range.invert();
this.time(this._time); this.time(this._time);
this.start();
return this; return this;
}, },