Skip to content

Commit

Permalink
chore: use default value
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed May 10, 2024
1 parent e17659d commit c0e9de2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/control/cad.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,10 @@ class CadControl extends Control {
* @param {Number} nbFeatures Number of features to search.
* @returns {Array.<ol.Feature>} List of closest features.
*/
getClosestFeatures(coordinate, nbFeatures) {
getClosestFeatures(coordinate, nbFeatures = 1) {
const editFeature = this.editor.getEditFeature();
const drawFeature = this.editor.getDrawFeature();
const currentFeatures = [editFeature, drawFeature].filter((f) => !!f);
const nb = nbFeatures || 1;

const cacheDist = {};
const dist = (f) => {
Expand All @@ -274,7 +273,7 @@ class CadControl extends Control {
.filter(this.filter)
.filter((f) => !currentFeatures.includes(f))
.sort(sortByDistance)
.slice(0, nb);
.slice(0, nbFeatures);

// When using showSnapPoints, return all features except edit/draw features
if (this.properties.showSnapPoints) {
Expand Down

0 comments on commit c0e9de2

Please sign in to comment.