diff --git a/examples/utfgrid.html b/examples/utfgrid.html index e76221e820..0c5befa9c6 100644 --- a/examples/utfgrid.html +++ b/examples/utfgrid.html @@ -4,7 +4,7 @@ @@ -14,25 +14,28 @@
-
diff --git a/lib/OpenLayers/Control/UTFGrid.js b/lib/OpenLayers/Control/UTFGrid.js index 0a2070a494..ae15f442a6 100644 --- a/lib/OpenLayers/Control/UTFGrid.js +++ b/lib/OpenLayers/Control/UTFGrid.js @@ -33,12 +33,6 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { element: null, debugElement: null, - /** - * Property: lastXy - * {} - */ - lastXy: null, - /** * Constructor: OpenLayers.Control.UTFGrid * Parameters: @@ -50,7 +44,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { 'stopMove': false, 'single': true, 'double': false, - 'pixelTolerance': 0, + 'pixelTolerance': 4, 'stopSingle': false, 'stopDouble': false }, @@ -115,7 +109,6 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { if (options.div) { this.element = OpenLayers.Util.getElement(options.div); } - this.resetHandler(); }, @@ -123,27 +116,15 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { * Method: handleEvent */ handleEvent: function(evt) { - var lonLat; - if (evt == null) { this.reset(); return; - } else { - if (this.lastXy == null || - Math.abs(evt.xy.x - this.lastXy.x) > this.granularity || - Math.abs(evt.xy.y - this.lastXy.y) > this.granularity) - { - this.lastXy = evt.xy; - return; - } - - lonLat = this.map.getLonLatFromPixel(evt.xy); - if (!lonLat) { - // map may not have been properly initialized - return; - } - this.lastXy = evt.xy; } + + var lonLat = this.map.getLonLatFromPixel(evt.xy); + if (!lonLat) { + return; + } var layers = this.findLayers(); if (layers.length > 0) { @@ -164,8 +145,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { Math.floor((info.i) / resolution) )); attrs = data.data[data.keys[code]]; - if (attrs) - this.callback(attrs); + this.callback(attrs); } } } @@ -198,11 +178,11 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { */ callback: function(attrs) { if (attrs !== null && typeof(attrs) !== 'undefined') { - val = "

Attributes