Ticket #2162: openlayers_dragtolerance.diff
| File openlayers_dragtolerance.diff, 1.2 kB (added by mmeno, 9 months ago) |
|---|
-
OpenLayers-2.7/lib/OpenLayers/Handler/Drag.js
old new 28 28 * - <OpenLayers.Handler> 29 29 */ 30 30 OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, { 31 31 32 pixelTolerance: 0, 33 32 34 /** 33 35 * Property: started 34 36 * {Boolean} When a mousedown event is received, we want to record it, but … … 301 303 * {Boolean} Let the event propagate. 302 304 */ 303 305 click: function (evt) { 304 // let the click event propagate only if the mouse moved 305 return (this.start == this.last); 306 //Only let the click propagate if we dragged less than the pixel tolerance 307 if (this.start) { 308 var dpx = Math.sqrt( 309 Math.pow(this.start.x - evt.xy.x, 2) + 310 Math.pow(this.start.y - evt.xy.y, 2) 311 ); 312 return (dpx <= this.pixelTolerance); 313 } 314 else { 315 return true; 316 } 306 317 }, 307 318 308 319 /**
