From: manufitoussi Date: Wed, 30 Jan 2013 09:58:45 +0000 (+0100) Subject: Resize event causes several mouseUp handler to be be added. Prevent multiple registra... X-Git-Tag: v1.0.0~107^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=8d9704289c9e6fab5bb88fb6a8529c83e0973742;p=dygraphs.git Resize event causes several mouseUp handler to be be added. Prevent multiple registration. --- diff --git a/dygraph.js b/dygraph.js index 89e3c46..2580556 100644 --- a/dygraph.js +++ b/dygraph.js @@ -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) {