Studio: studio now supports loading self-made layers in themes
This commit is contained in:
parent
9716bc5425
commit
28bf8cca9f
24 changed files with 826 additions and 464 deletions
|
@ -39,7 +39,7 @@ export abstract class Conversion<TIn, TOut> {
|
|||
ConversionContext.print(msg)
|
||||
}
|
||||
if (context.hasErrors()) {
|
||||
throw "Detected one or more errors, stopping now"
|
||||
throw new Error(["Detected one or more errors, stopping now:", context.getAll("error").map(e => e.context.path.join(".")+": "+e.message)].join("\n\t"))
|
||||
}
|
||||
return fixed
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ class AddDefaultLayers extends DesugaringStep<LayoutConfigJson> {
|
|||
|
||||
convert(json: LayoutConfigJson, context: ConversionContext): LayoutConfigJson {
|
||||
const state = this._state
|
||||
json.layers = [...(json.layers ?? [])]
|
||||
json.layers = Utils.NoNull([...(json.layers ?? [])])
|
||||
const alreadyLoaded = new Set(json.layers.map((l) => l["id"]))
|
||||
|
||||
for (const layerName of Constants.added_by_default) {
|
||||
|
|
|
@ -156,7 +156,7 @@ export interface LayoutConfigJson {
|
|||
* type: layer[]
|
||||
* types: hidden | layer | hidden
|
||||
* group: layers
|
||||
* suggestions: return Array.from(layers.keys()).map(key => ({if: "value="+key, then: key+" - "+layers.get(key).description}))
|
||||
* suggestions: return Array.from(layers.keys()).map(key => ({if: "value="+key, then: "<b>"+key+"</b> (builtin) - "+layers.get(key).description}))
|
||||
* Every layer contains a description of which feature to display - the overpassTags which are queried.
|
||||
* Instead of running one query for every layer, the query is fused.
|
||||
*
|
||||
|
|
|
@ -233,7 +233,7 @@ export default class TagRenderingConfig {
|
|||
}
|
||||
|
||||
const firstMappingSize: string = json.mappings
|
||||
.map((m) => m.icon?.["class"])
|
||||
.map((m) => m?.icon?.["class"])
|
||||
.find((c) => !!c)
|
||||
const commonIconSize = firstMappingSize ?? json["#iconsize"] ?? "small"
|
||||
this.mappings = json.mappings.map((m, i) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue