Refactoring: fix usersettings vis

This commit is contained in:
Pieter Vander Vennet 2023-04-16 04:26:50 +02:00
parent 9a282cbce4
commit f203a1158d
2 changed files with 5 additions and 2 deletions

View file

@ -34,7 +34,7 @@ export class MinimapViz implements SpecialVisualization {
feature: Feature,
layer: LayerConfig
) {
if (state === undefined) {
if (state === undefined || feature === undefined || layer.source === undefined) {
return undefined
}
const keys = [...args]
@ -83,6 +83,9 @@ export class MinimapViz implements SpecialVisualization {
}
}
featuresToShow.addCallbackAndRunD((features) => {
if (features.length === 0) {
return
}
const bboxGeojson = GeoOperations.bbox({ features, type: "FeatureCollection" })
const [lon, lat] = GeoOperations.centerpointCoordinates(bboxGeojson)
mla.bounds.setData(BBox.get(bboxGeojson))