forked from MapComplete/MapComplete
Refactoring: fix usersettings vis
This commit is contained in:
parent
9a282cbce4
commit
f203a1158d
2 changed files with 5 additions and 2 deletions
|
@ -1144,7 +1144,7 @@ export class AddMiniMap extends DesugaringStep<LayerConfigJson> {
|
||||||
}
|
}
|
||||||
|
|
||||||
convert(layerConfig: LayerConfigJson, context: string): { result: LayerConfigJson } {
|
convert(layerConfig: LayerConfigJson, context: string): { result: LayerConfigJson } {
|
||||||
if (!layerConfig.tagRenderings) {
|
if (!layerConfig.tagRenderings || layerConfig.source === "special") {
|
||||||
return { result: layerConfig }
|
return { result: layerConfig }
|
||||||
}
|
}
|
||||||
const state = this._state
|
const state = this._state
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class MinimapViz implements SpecialVisualization {
|
||||||
feature: Feature,
|
feature: Feature,
|
||||||
layer: LayerConfig
|
layer: LayerConfig
|
||||||
) {
|
) {
|
||||||
if (state === undefined) {
|
if (state === undefined || feature === undefined || layer.source === undefined) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const keys = [...args]
|
const keys = [...args]
|
||||||
|
@ -83,6 +83,9 @@ export class MinimapViz implements SpecialVisualization {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
featuresToShow.addCallbackAndRunD((features) => {
|
featuresToShow.addCallbackAndRunD((features) => {
|
||||||
|
if (features.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const bboxGeojson = GeoOperations.bbox({ features, type: "FeatureCollection" })
|
const bboxGeojson = GeoOperations.bbox({ features, type: "FeatureCollection" })
|
||||||
const [lon, lat] = GeoOperations.centerpointCoordinates(bboxGeojson)
|
const [lon, lat] = GeoOperations.centerpointCoordinates(bboxGeojson)
|
||||||
mla.bounds.setData(BBox.get(bboxGeojson))
|
mla.bounds.setData(BBox.get(bboxGeojson))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue