forked from MapComplete/MapComplete
UX+Docs: improve documentation of background layer switch, export ELI-docs, load background layer based on category
This commit is contained in:
parent
33e9a94199
commit
0c4d81916f
7 changed files with 1034 additions and 69 deletions
|
@ -1,5 +1,6 @@
|
|||
import { Store, UIEventSource } from "../UIEventSource"
|
||||
import { AvailableRasterLayers, RasterLayerPolygon } from "../../Models/RasterLayers"
|
||||
import { eliCategory } from "../../Models/RasterLayerProperties"
|
||||
|
||||
/**
|
||||
* Selects the appropriate raster layer as background for the given query parameter, theme setting, user preference or default value.
|
||||
|
@ -64,7 +65,7 @@ export class PreferredRasterLayerSelector {
|
|||
private async updateLayer() {
|
||||
// What is the ID of the layer we have to (try to) load?
|
||||
const targetLayerId = (
|
||||
this._queryParameter.data ?? this._preferredBackgroundLayer.data
|
||||
(this._queryParameter.data ?? this._preferredBackgroundLayer.data)?.toLowerCase()
|
||||
)?.toLowerCase()
|
||||
if (targetLayerId === undefined || targetLayerId === "default") {
|
||||
return
|
||||
|
@ -77,8 +78,7 @@ export class PreferredRasterLayerSelector {
|
|||
return
|
||||
}
|
||||
await AvailableRasterLayers.editorLayerIndex()
|
||||
const isCategory =
|
||||
targetLayerId === "photo" || targetLayerId === "osmbasedmap" || targetLayerId === "map"
|
||||
const isCategory = (eliCategory).indexOf(<any> targetLayerId) >= 0
|
||||
const available = this._availableLayers.store.data
|
||||
const foundLayer = isCategory
|
||||
? available.find((l) => l.properties.category === targetLayerId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue