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