From 11c1ef3f68ed0569edab2f3ff1b4b36ed11fa639 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 9 Jan 2008 09:55:22 +0000 Subject: [PATCH] The pixelTolerance check on the click handler only works if mousedown events get to the handler. This keeps the handler from failing in cases where mousedown is stopped and pixelTolerance is set. r=crschmidt (closes #1246) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5698 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Handler/Click.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Handler/Click.js b/lib/OpenLayers/Handler/Click.js index 135aba1073..0ff5246c12 100644 --- a/lib/OpenLayers/Handler/Click.js +++ b/lib/OpenLayers/Handler/Click.js @@ -171,14 +171,18 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, { /** * Method: passesTolerance - * Determine whether the event is within the optional pixel tolerance. + * Determine whether the event is within the optional pixel tolerance. Note + * that the pixel tolerance check only works if mousedown events get to + * the listeners registered here. If they are stopped by other elements, + * the will have no effect here (this method will always + * return true). * * Returns: * {Boolean} The click is within the pixel tolerance (if specified). */ passesTolerance: function(evt) { var passes = true; - if(this.pixelTolerance) { + if(this.pixelTolerance && this.down) { var dpx = Math.sqrt( Math.pow(this.down.x - evt.xy.x, 2) + Math.pow(this.down.y - evt.xy.y, 2)