From c785c2813b20c1823be4819f48535bc820453fe1 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Thu, 6 Jan 2022 21:10:26 +0100 Subject: [PATCH] Filter for actual geometry intersection --- examples/box-selection.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/box-selection.js b/examples/box-selection.js index 08466edae6..7b9af7ad13 100644 --- a/examples/box-selection.js +++ b/examples/box-selection.js @@ -43,7 +43,9 @@ map.addInteraction(dragBox); dragBox.on('boxend', function () { const extent = dragBox.getGeometry().getExtent(); - const boxFeatures = vectorSource.getFeaturesInExtent(extent); + const boxFeatures = vectorSource + .getFeaturesInExtent(extent) + .filter((feature) => feature.getGeometry().intersectsExtent(extent)); // features that intersect the box geometry are added to the // collection of selected features