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
This commit is contained in:
Tim Schaub
2008-01-09 09:55:22 +00:00
parent 5b31ee3c0a
commit 11c1ef3f68

View File

@@ -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 <pixelTolerance> 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)