forked from MapComplete/MapComplete
Merge master
This commit is contained in:
commit
36caf511cf
6 changed files with 286 additions and 7 deletions
|
@ -225,6 +225,37 @@ export class AddMiniMap extends DesugaringStep<LayerConfigJson> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ApplyOverrideAll extends DesugaringStep<LayoutConfigJson> {
|
||||
|
||||
constructor() {
|
||||
super("Applies 'overrideAll' onto every 'layer'. The 'overrideAll'-field is removed afterwards", ["overrideAll", "layers"]);
|
||||
}
|
||||
|
||||
convert(state: DesugaringContext, json: LayoutConfigJson, context: string): { result: LayoutConfigJson; errors: string[]; warnings: string[] } {
|
||||
|
||||
const overrideAll = json.overrideAll;
|
||||
if (overrideAll === undefined) {
|
||||
return {result: json, warnings: [], errors: []}
|
||||
}
|
||||
|
||||
json = {...json}
|
||||
|
||||
delete json.overrideAll
|
||||
const newLayers = []
|
||||
for (let layer of json.layers) {
|
||||
layer = {...<LayerConfigJson>layer}
|
||||
Utils.Merge(overrideAll, layer)
|
||||
newLayers.push(layer)
|
||||
}
|
||||
json.layers = newLayers
|
||||
|
||||
|
||||
return {result: json, warnings: [], errors: []};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
|
||||
constructor() {
|
||||
super("If a layer has a dependency on another layer, these layers are added automatically on the theme. (For example: defibrillator depends on 'walls_and_buildings' to snap onto. This layer is added automatically)", ["layers"]);
|
||||
|
@ -306,11 +337,13 @@ export class PrepareTheme extends Fuse<LayoutConfigJson> {
|
|||
constructor() {
|
||||
super(
|
||||
"Fully prepares and expands a theme",
|
||||
|
||||
new OnEveryConcat("layers", new SubstituteLayer()),
|
||||
new SetDefault("socialImage", "assets/SocialImage.png", true),
|
||||
new OnEvery("layers", new PrepareLayer()),
|
||||
new ApplyOverrideAll(),
|
||||
new AddDefaultLayers(),
|
||||
new AddDependencyLayersToTheme(),
|
||||
new OnEvery("layers", new PrepareLayer()),
|
||||
new AddImportLayers(),
|
||||
new OnEvery("layers", new AddMiniMap())
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue