From 4f809a9714663dc735c87c0e9ce0bf38a6f2fe04 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 15 Apr 2010 14:44:50 +0000 Subject: [PATCH] Avoid duplicate feature requests for clicks, and make clear that the click handler takes precedence over the box handler. r=bartvde,pgiraud (pullup #2581) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10215 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/GetFeature.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Control/GetFeature.js b/lib/OpenLayers/Control/GetFeature.js index d7a50b3461..b53bdb5b25 100644 --- a/lib/OpenLayers/Control/GetFeature.js +++ b/lib/OpenLayers/Control/GetFeature.js @@ -59,8 +59,10 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { /** * APIProperty: click - * {Boolean} Use a click handler for selecting/unselecting features. - * Default is true. + * {Boolean} Use a click handler for selecting/unselecting features. If + * both and are set to true, the click handler takes + * precedence over the box handler if a box with zero extent was + * selected. If both clicks and Default is true. */ click: true, @@ -305,7 +307,11 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { ); } else { - bounds = this.pixelToBounds(position); + if(this.click) { + // box without extent - let the click handler take care of it + return; + } + bounds = this.pixelToBounds(position); } this.setModifiers(this.handlers.box.dragHandler.evt); this.request(bounds);