From 5edcc9724045477633d640749707086ef17c32c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 28 Jan 2010 08:07:09 +0000 Subject: [PATCH] cannot unselect on clickout when selecting by drawing a box, r=pgiraud (closes #2204) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9979 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/SelectFeature.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/OpenLayers/Control/SelectFeature.js b/lib/OpenLayers/Control/SelectFeature.js index feb3588b94..55d79cef56 100644 --- a/lib/OpenLayers/Control/SelectFeature.js +++ b/lib/OpenLayers/Control/SelectFeature.js @@ -484,6 +484,13 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, { if(cont !== false) { layer.selectedFeatures.push(feature); this.highlight(feature); + // if the feature handler isn't involved in the feature + // selection (because the box handler is used or the + // feature is selected programatically) we fake the + // feature handler to allow unselecting on click + if(!this.handlers.feature.lastFeature) { + this.handlers.feature.lastFeature = layer.selectedFeatures[0]; + } layer.events.triggerEvent("featureselected", {feature: feature}); this.onSelect.call(this.scope, feature); }