From: Dan Vanderkam Date: Fri, 6 Mar 2015 19:45:35 +0000 (-0500) Subject: Merge pull request #534 from cthrax/master X-Git-Tag: v2.0.0~75 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=7e155e4703bb13959771db49a2ecd669b33ddf6c;hp=710ac67ad54c012c5e6b53b5e9f4bbe5e3c0b1df;p=dygraphs.git Merge pull request #534 from cthrax/master Add cleanup function to the animation selection so that clearing a selec... --- diff --git a/bower.json b/bower.json index a4157c6..04900c3 100644 --- a/bower.json +++ b/bower.json @@ -11,7 +11,6 @@ "compile-with-closure.sh", "dashed-canvas.js", "data.js", - "datahandler", "docs", "experimental", "file-size-stats.sh", @@ -37,6 +36,6 @@ "screenshot.png", "test.sh", "tests", - "thumbnail.png", + "thumbnail.png" ] } diff --git a/dygraph.js b/dygraph.js index 5f6e1e1..4502bd4 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2019,6 +2019,14 @@ Dygraph.prototype.animateSelection_ = function(direction) { var thisId = ++this.animateId; var that = this; + var cleanupIfClearing = function() { + // if we haven't reached fadeLevel 0 in the max frame time, + // ensure that the clear happens and just go to 0 + if (that.fadeLevel !== 0 && direction < 0) { + that.fadeLevel = 0; + that.clearSelection(); + } + }; Dygraph.repeatAndCleanup( function(n) { // ignore simultaneous animations @@ -2031,7 +2039,7 @@ Dygraph.prototype.animateSelection_ = function(direction) { that.updateSelection_(that.fadeLevel / totalSteps); } }, - steps, millis, function() {}); + steps, millis, cleanupIfClearing); }; /**