From: Robert Konigsberg Date: Wed, 25 May 2011 18:59:10 +0000 (-0400) Subject: Small bug: when selPoints_ is empty, pointClickCallback is always called X-Git-Tag: v1.0.0~463^2~1^2~5 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=5d48586bae561162d3f6abe8a2092066c8977b4a;p=dygraphs.git Small bug: when selPoints_ is empty, pointClickCallback is always called because closestDistance < 5*5. So make it MAX_NUM. We could probably remove the closestIdx == 1 too. --- diff --git a/dygraph.js b/dygraph.js index 6adb43b..e3e8daa 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1333,7 +1333,7 @@ Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) { if (g.attr_('pointClickCallback')) { // check if the click was on a particular point. var closestIdx = -1; - var closestDistance = 0; + var closestDistance = Number.MAX_VALUE; for (var i = 0; i < g.selPoints_.length; i++) { var p = g.selPoints_[i]; var distance = Math.pow(p.canvasx - context.dragEndX, 2) +