From: Tanner Linsley Date: Sun, 12 Apr 2015 06:05:31 +0000 (-0600) Subject: Only start digest on first request. Cleanup X-Git-Tag: v2.0-alpha~37^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14f4fae786857c10f2a85ab00be6b78868390fff;p=thirdparty%2FChart.js.git Only start digest on first request. Cleanup --- diff --git a/src/Chart.Core.js b/src/Chart.Core.js index fcdc77636..22a338d42 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -2088,7 +2088,7 @@ }); // If there are no animations queued, manually kickstart a digest, for lack of a better word - if (this.animations.length) { + if (this.animations.length == 1) { helpers.requestAnimFrame.call(window, this.digestWrapper); } }, @@ -2119,20 +2119,18 @@ for (var i = 0; i < this.animations.length; i++) { - var currentAnimation = this.animations[i]; + if (this.animations[i].animationObject.currentStep === null){ + this.animations[i].animationObject.currentStep = 0; + } - if (currentAnimation.animationObject.currentStep === null){ - currentAnimation.animationObject.currentStep = 0; - } else { - currentAnimation.animationObject.currentStep += 1 + framesToDrop; - if(currentAnimation.animationObject.currentStep > currentAnimation.animationObject.numSteps){ - currentAnimation.animationObject.currentStep = currentAnimation.animationObject.numSteps; - } + this.animations[i].animationObject.currentStep += 1 + framesToDrop; + if(this.animations[i].animationObject.currentStep > this.animations[i].animationObject.numSteps){ + this.animations[i].animationObject.currentStep = this.animations[i].animationObject.numSteps; } - currentAnimation.animationObject.render(currentAnimation.chartInstance, currentAnimation.animationObject); + this.animations[i].animationObject.render(this.animations[i].chartInstance, this.animations[i].animationObject); - if (currentAnimation.animationObject.currentStep == currentAnimation.animationObject.numSteps){ + if (this.animations[i].animationObject.currentStep == this.animations[i].animationObject.numSteps){ // executed the last frame. Remove the animation. this.animations.splice(i, 1); // Keep the index in place to offset the splice