From da1369a5acf5304973dcc061c6682fd167ee67da Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 9 May 2011 13:13:20 -0400 Subject: [PATCH] fix lingering hover dot on zoom bug --- dygraph.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dygraph.js b/dygraph.js index 7dad6b2..888abd9 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1681,6 +1681,9 @@ Dygraph.prototype.doUnzoom_ = function() { } } + // Clear any selection, since it's likely to be drawn in the wrong place. + this.clearSelection(); + if (dirty) { // Putting the drawing operation before the callback because it resets // yAxisRange. @@ -2807,8 +2810,10 @@ Dygraph.prototype.drawGraph_ = function() { this.setLegendHTML_(); } else { if (typeof(this.selPoints_) !== 'undefined' && this.selPoints_.length) { - this.lastx_ = this.selPoints_[0].xval; - this.updateSelection_(); + // We should select the point nearest the page x/y here, but it's easier + // to just clear the selection. This prevents erroneous hover dots from + // being displayed. + this.clearSelection(); } else { this.clearSelection(); } -- 2.7.4