Merge branch 'develop'

This commit is contained in:
Pieter Vander Vennet 2022-01-18 21:26:42 +01:00
commit 9148775c9a
329 changed files with 817 additions and 760 deletions

View file

@ -3,7 +3,6 @@ import LayerConfig from "../LayerConfig";
import {LayerConfigJson} from "../Json/LayerConfigJson";
import Translations from "../../../UI/i18n/Translations";
import {TagsFilter} from "../../../Logic/Tags/TagsFilter";
import {Tag} from "../../../Logic/Tags/Tag";
import {And} from "../../../Logic/Tags/And";
export default class CreateNoteImportLayer extends Conversion<LayerConfig, LayerConfigJson> {

View file

@ -898,18 +898,20 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
}
}
class SetDefault extends DesugaringStep<LayerConfigJson> {
private readonly value: object;
class SetDefault<T> extends DesugaringStep<T> {
private readonly value: any;
private readonly key: string;
private readonly _overrideEmptyString: boolean;
constructor(key: string, value: object) {
constructor(key: string, value: any, overrideEmptyString = false) {
super("Sets " + key + " to a default value if undefined");
this.key = key;
this.value = value;
this._overrideEmptyString = overrideEmptyString;
}
convert(state: DesugaringContext, json: LayerConfigJson, context: string): { result: LayerConfigJson; errors: string[]; warnings: string[] } {
if (json[this.key] === undefined) {
convert(state: DesugaringContext, json: T, context: string): { result: T; errors: string[]; warnings: string[] } {
if (json[this.key] === undefined || (json[this.key] === "" && this._overrideEmptyString)) {
json = {...json}
json[this.key] = this.value
}
@ -1044,6 +1046,7 @@ export class PrepareTheme extends Fuse<LayoutConfigJson> {
super(
"Fully prepares and expands a theme",
new OnEveryConcat("layers", new SubstituteLayer()),
new SetDefault("socialImage", "assets/SocialImage.png", true),
new AddDefaultLayers(),
new AddDependencyLayersToTheme(),
new OnEvery("layers", new PrepareLayer()),

View file

@ -102,6 +102,11 @@ export default class LayoutConfig {
this.descriptionTail = json.descriptionTail === undefined ? undefined : new Translation(json.descriptionTail, context + ".descriptionTail");
this.icon = json.icon;
this.socialImage = json.socialImage;
if(this.socialImage === null || this.socialImage === "" || this.socialImage === undefined){
if(official){
throw "Theme "+json.id+" has no social image defined"
}
}
this.startZoom = json.startZoom;
this.startLat = json.startLat;
this.startLon = json.startLon;

View file

@ -1,6 +1,3 @@
import {control} from "leaflet";
export interface TileRange {
xstart: number,
ystart: number,