fix an resize issue : when the window has resized, mouseout and mousemove handlers...
authormanufitoussi <manu.fitoussi@gmail.com>
Wed, 30 Jan 2013 09:57:21 +0000 (10:57 +0100)
committermanufitoussi <manu.fitoussi@gmail.com>
Wed, 30 Jan 2013 09:57:21 +0000 (10:57 +0100)
dygraph.js

index 43d3011..89e3c46 100644 (file)
@@ -956,19 +956,20 @@ Dygraph.prototype.createInterface_ = function() {
 
   var dygraph = this;
 
-  // Don't recreate and register the handlers on subsequent calls.
-  // This happens when the graph is resized.
-  if (!this.mouseMoveHandler_) {
-    this.mouseMoveHandler_ = function(e) {
-      dygraph.mouseMove_(e);
-    };
-    this.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
+  this.mouseMoveHandler_ = function(e) {
+    dygraph.mouseMove_(e);
+  };
 
-    this.mouseOutHandler_ = function(e) {
-      dygraph.mouseOut_(e);
-    };
-    this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
+  this.mouseOutHandler_ = function(e) {
+    dygraph.mouseOut_(e);
+  };
+
+  this.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
+  this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
 
+  // Don't recreate and register the resize handler on subsequent calls.
+  // This happens when the graph is resized.
+  if (!this.resizeHandler_) {
     this.resizeHandler_ = function(e) {
       dygraph.resize();
     };