Skip to content

Commit

Permalink
avoid duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-000 committed Mar 26, 2023
1 parent 84efe51 commit f104969
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/box-selection.js
Expand Up @@ -84,8 +84,11 @@ dragBox.on('boxend', function () {

const boxFeatures = vectorSource
.getFeaturesInExtent(extent)
.filter((feature) => !selectedFeatures.getArray().includes(feature))
.filter((feature) => feature.getGeometry().intersectsExtent(extent));
.filter(
(feature) =>
!selectedFeatures.getArray().includes(feature) &&
feature.getGeometry().intersectsExtent(extent)
);

// features that intersect the box geometry are added to the
// collection of selected features
Expand Down

0 comments on commit f104969

Please sign in to comment.