Fix stuck fading animation for series highlighting
authorKlaus Weidner <klausw@google.com>
Wed, 29 Feb 2012 00:06:32 +0000 (16:06 -0800)
committerKlaus Weidner <klausw@google.com>
Wed, 29 Feb 2012 00:11:56 +0000 (16:11 -0800)
The animateId field wasn't being initialized correctly if
clearSelection() got called before the first call to setSelection().

TODO(klausw): add more generic support for animating changes to option
values?

dygraph.js

index bc830b2..d79fa88 100644 (file)
@@ -1851,10 +1851,8 @@ Dygraph.prototype.setLegendHTML_ = function(x, sel_points) {
 Dygraph.prototype.animateSelection_ = function(direction) {
   var totalSteps = 10;
   var millis = 30;
-  if (this.fadeLevel === undefined) {
-    this.fadeLevel = 0;
-    this.animateId = 0;
-  }
+  if (this.fadeLevel === undefined) this.fadeLevel = 0;
+  if (this.animateId === undefined) this.animateId = 0;
   var start = this.fadeLevel;
   var steps = direction < 0 ? start : totalSteps - start;
   if (steps <= 0) {