Resize event causes several mouseUp handler to be be added. Prevent multiple registra...
authormanufitoussi <manu.fitoussi@gmail.com>
Wed, 30 Jan 2013 09:58:45 +0000 (10:58 +0100)
committermanufitoussi <manu.fitoussi@gmail.com>
Wed, 30 Jan 2013 09:58:45 +0000 (10:58 +0100)
dygraph.js

index 89e3c46..2580556 100644 (file)
@@ -1278,6 +1278,12 @@ Dygraph.prototype.createDragInterface_ = function() {
         bindHandler(interactionModel[eventName]));
   }
 
+  // unregister the handler on subsequent calls.
+  // This happens when the graph is resized.
+  if (this.mouseUpHandler_) {
+    Dygraph.removeEvent(document, 'mouseup', this.mouseUpHandler_);
+  };
+
   // If the user releases the mouse button during a drag, but not over the
   // canvas, then it doesn't count as a zooming action.
   this.mouseUpHandler_ = function(event) {