From 08aa6ee82d2c263688261e1dc5a6a073c89394d6 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Tue, 11 Nov 2014 12:35:19 +0100 Subject: [PATCH 1/2] Do not rely on unstable index --- src/ol/interaction/selectinteraction.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/interaction/selectinteraction.js b/src/ol/interaction/selectinteraction.js index 5c4067e3db..3f690e2189 100644 --- a/src/ol/interaction/selectinteraction.js +++ b/src/ol/interaction/selectinteraction.js @@ -154,7 +154,7 @@ ol.interaction.Select.prototype.handleMapBrowserEvent = } } else { // Modify the currently selected feature(s). - var /** @type {Array.} */ deselected = []; + var /** @type {Array.} */ deselected = []; var /** @type {Array.} */ selected = []; map.forEachFeatureAtPixel(mapBrowserEvent.pixel, /** @@ -175,7 +175,7 @@ ol.interaction.Select.prototype.handleMapBrowserEvent = }, undefined, this.layerFilter_); var i; for (i = deselected.length - 1; i >= 0; --i) { - features.removeAt(deselected[i]); + features.remove(deselected[i]); } features.extend(selected); } From 96729baa9f3684075835cbbb8ebc17eaf32fa1e2 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Tue, 11 Nov 2014 20:09:24 +0100 Subject: [PATCH 2/2] Push the feature, not the index --- src/ol/interaction/selectinteraction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/interaction/selectinteraction.js b/src/ol/interaction/selectinteraction.js index 3f690e2189..1a32311390 100644 --- a/src/ol/interaction/selectinteraction.js +++ b/src/ol/interaction/selectinteraction.js @@ -169,7 +169,7 @@ ol.interaction.Select.prototype.handleMapBrowserEvent = } } else { if (remove || toggle) { - deselected.push(index); + deselected.push(feature); } } }, undefined, this.layerFilter_);