From: Dan Vanderkam Date: Fri, 1 Feb 2013 17:21:51 +0000 (-0800) Subject: Merge pull request #199 from witsa/master X-Git-Tag: v1.0.0~105 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=7071b20650f42804b37ecec270bc99729403dd0c;hp=9adc2c3372cc8fc0137a5bef606fa93077e01c21;p=dygraphs.git Merge pull request #199 from witsa/master some robustness and partial auto value range --- diff --git a/docs/changes.html b/docs/changes.html index 6ee7300..12a9d52 100644 --- a/docs/changes.html +++ b/docs/changes.html @@ -57,9 +57,17 @@ it.
This ensures that we won't inadvertently break your feature in the future. To do this, either add to an existing auto_test in - auto_tests/tests or run "auto_tests/misc/new-test.sh your-test-name" to - create a new one. You can run your auto_test in any browser by visiting - auto_tests/misc/local.html. + auto_tests/tests or run + auto_tests/misc/new-test.sh your-test-name to + create a new one. There are two easy ways to run tests: +

Sending a Pull Request

diff --git a/dygraph.js b/dygraph.js index 63b2edb..941badb 100644 --- a/dygraph.js +++ b/dygraph.js @@ -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(); }; @@ -1280,6 +1281,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) {