From: Evert Timberg Date: Sun, 12 Apr 2015 00:17:46 +0000 (-0400) Subject: Implement cancel animation frame in the animation service X-Git-Tag: v2.0-alpha~37^2~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26eca2370609204bf58284e382123a21973f52ee;p=thirdparty%2FChart.js.git Implement cancel animation frame in the animation service --- diff --git a/src/Chart.Core.js b/src/Chart.Core.js index 7e48ead00..565ceeeb1 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -911,7 +911,7 @@ }, stop : function(){ // Stops any current animation loop occuring - cancelAnimFrame(this.animationFrame); + Chart.animationService.cancelAnimation(this); return this; }, resize : function(callback){ @@ -2097,6 +2097,17 @@ helpers.requestAnimFrame.call(window, this.digestWrapper); } }, + // Cancel the animation for a given chart instance + cancelAnimation: function(chartInstance) { + var index = helpers.findNextWhere(this.animations, function(animationWrapper) { + return animationWrapper.chartInstance === chartInstance; + }); + + if (index != -1) + { + this.animations.splice(index, 1); + } + }, // calls startDigest with the proper context digestWrapper: function() { Chart.animationService.startDigest.call(Chart.animationService);