Fix feature-layer association on replaced selections

This commit is contained in:
Andreas Hocevar
2016-04-21 08:36:42 +02:00
parent ed6ac93222
commit c11e95099c
2 changed files with 13 additions and 10 deletions

View File

@@ -280,6 +280,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
// Replace the currently selected feature(s) with the feature(s) at the
// pixel, or clear the selected feature(s) if there is no feature at
// the pixel.
ol.object.clear(this.featureLayerAssociation_);
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
/**
* @param {ol.Feature|ol.render.Feature} feature Feature.
@@ -303,16 +304,6 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
features.clear();
}
features.extend(selected);
// Modify object this.featureLayerAssociation_
if (selected.length === 0) {
ol.object.clear(this.featureLayerAssociation_);
} else {
if (deselected.length > 0) {
deselected.forEach(function(feature) {
this.removeFeatureLayerAssociation_(feature);
}, this);
}
}
}
} else {
// Modify the currently selected feature(s).