X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=78b45f57bea0ed903eb48cba81547778217e8822;hb=dc836ebb77ab18a402ea4ae590059299d88b0deb;hp=4b3b5e1f27a743d6398aef9e4e1250d9209f4eaa;hpb=fcf37b294f0f83b799c756017cab8ee0ceeb9a3e;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 4b3b5e1..78b45f5 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); }; /**