Properly detect feature on unmanaged layer for toggle selection

This commit is contained in:
Andreas Hocevar
2016-01-27 14:07:26 +01:00
parent 7b78c215ae
commit ecb2a42900
3 changed files with 45 additions and 2 deletions

View File

@@ -323,7 +323,8 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
* @param {ol.layer.Layer} layer Layer.
*/
function(feature, layer) {
if (layer !== this.featureOverlay_) {
goog.asserts.assertInstanceof(feature, ol.Feature);
if (layer !== null) {
if (add || toggle) {
if (this.filter_(feature, layer) &&
!ol.array.includes(features.getArray(), feature) &&
@@ -332,7 +333,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
this.addFeatureLayerAssociation_(feature, layer);
}
}
} else {
} else if (this.featureOverlay_.getSource().hasFeature(feature)) {
if (remove || toggle) {
deselected.push(feature);
this.removeFeatureLayerAssociation_(feature);