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
This commit is contained in:
Éric Lemoine
2010-01-28 08:07:09 +00:00
parent 153cba8147
commit 5edcc97240

View File

@@ -484,6 +484,13 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
if(cont !== false) { if(cont !== false) {
layer.selectedFeatures.push(feature); layer.selectedFeatures.push(feature);
this.highlight(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}); layer.events.triggerEvent("featureselected", {feature: feature});
this.onSelect.call(this.scope, feature); this.onSelect.call(this.scope, feature);
} }