Skip to content

Commit

Permalink
refactor(popup): Reset featureLayersUnderMouse along with features un…
Browse files Browse the repository at this point in the history
…der mouse
  • Loading branch information
FilipLeitner committed Nov 19, 2024
1 parent 02e27df commit 90a71f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class HsQueryPopupBaseService extends HsQueryPopupData {
}
} else {
this.featuresUnderMouse = [];
this.featureLayersUnderMouse = [];
}
});
}
Expand All @@ -88,6 +89,7 @@ export class HsQueryPopupBaseService extends HsQueryPopupData {
*/
closePopup(): void {
this.featuresUnderMouse = [];
this.featureLayersUnderMouse = [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class HsClearLayerComponent
}
layer.getSource().clear();
this.data.service.featuresUnderMouse = [];
this.data.service.featureLayersUnderMouse = [];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class HsFeatureInfoComponent
if (confirmed == 'yes') {
this.hsQueryVectorService.removeFeature(feature);
this.data.service.featuresUnderMouse = [];
this.data.service.featureLayersUnderMouse = [];
}
}

Expand Down
15 changes: 0 additions & 15 deletions projects/hslayers/services/query/query-vector.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,6 @@ export class HsQueryVectorService {
});
}

/**
* Get features under the mouse pointer on the map
* @param map - Current map object
* @param pixel - Target pixel
* @returns Array with features
*/
getFeaturesUnderMouse(map: Map, pixel: number[]): FeatureLike[] {
return map
.getFeaturesAtPixel(pixel)
.filter((feature: Feature<Geometry>) => {
const layer = this.hsMapService.getLayerForFeature(feature);
return layer && layer != this.hsQueryBaseService.queryLayer;
});
}

/**
* Get selected features original data
* @param feature - Feature selected
Expand Down

0 comments on commit 90a71f1

Please sign in to comment.