From: manufitoussi Date: Wed, 30 Jan 2013 09:57:21 +0000 (+0100) Subject: fix an resize issue : when the window has resized, mouseout and mousemove handlers... X-Git-Tag: v1.0.0~107^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=9fd9bbbb415331b3a9de0fbfb053820bccc2abac;p=dygraphs.git fix an resize issue : when the window has resized, mouseout and mousemove handlers are no longer registered. --- diff --git a/dygraph.js b/dygraph.js index 43d3011..89e3c46 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(); };