diff --git a/Logic/State/MapState.ts b/Logic/State/MapState.ts index 5a728cf22..815ea54d3 100644 --- a/Logic/State/MapState.ts +++ b/Logic/State/MapState.ts @@ -301,7 +301,7 @@ export default class MapState extends UserRelatedState { } else { isDisplayed = QueryParameters.GetBooleanQueryParameter( "layer-" + layer.id, - "true", + ""+layer.shownByDefault, "Wether or not layer " + layer.id + " is shown" ) } diff --git a/Logic/Tags/TagUtils.ts b/Logic/Tags/TagUtils.ts index dd54d011a..474fbc54e 100644 --- a/Logic/Tags/TagUtils.ts +++ b/Logic/Tags/TagUtils.ts @@ -255,6 +255,9 @@ export class TagUtils { } if (tag.indexOf("~") >= 0) { const split = Utils.SplitFirst(tag, "~"); + if(split[1] === "") { + throw "Detected a regextag with an empty regex; this is not allowed. Use '"+split[0]+"='instead (at "+context+")" + } if (split[1] === "*") { split[1] = "..*" } diff --git a/Models/ThemeConfig/Json/LayerConfigJson.ts b/Models/ThemeConfig/Json/LayerConfigJson.ts index c45548bb9..796ef91fc 100644 --- a/Models/ThemeConfig/Json/LayerConfigJson.ts +++ b/Models/ThemeConfig/Json/LayerConfigJson.ts @@ -109,6 +109,13 @@ export interface LayerConfigJson { */ minzoom?: number; + + /** + * Indicates if this layer is shown by default; + * can be used to hide a layer from start, or to load the layer but only to show it where appropriate (e.g. for snapping to it) + */ + shownByDefault?: true | boolean; + /** * The zoom level at which point the data is hidden again * Default: 100 (thus: always visible diff --git a/Models/ThemeConfig/LayerConfig.ts b/Models/ThemeConfig/LayerConfig.ts index 34245bd7b..4f5547b42 100644 --- a/Models/ThemeConfig/LayerConfig.ts +++ b/Models/ThemeConfig/LayerConfig.ts @@ -47,6 +47,7 @@ export default class LayerConfig extends WithContextLoader { public readonly deletion: DeleteConfig | null; public readonly allowMove: MoveConfig | null public readonly allowSplit: boolean + public readonly shownByDefault: boolean; /** * In seconds */ @@ -147,6 +148,7 @@ export default class LayerConfig extends WithContextLoader { this.passAllFeatures = json.passAllFeatures ?? false; this.minzoom = json.minzoom ?? 0; this.minzoomVisible = json.minzoomVisible ?? this.minzoom; + this.shownByDefault = json.shownByDefault ?? true; if (json.presets !== undefined && json.presets?.map === undefined) { throw "Presets should be a list of items (at " + context + ")" } diff --git a/Models/ThemeConfig/LayoutConfig.ts b/Models/ThemeConfig/LayoutConfig.ts index 61efd8520..5a1b3bcd8 100644 --- a/Models/ThemeConfig/LayoutConfig.ts +++ b/Models/ThemeConfig/LayoutConfig.ts @@ -221,6 +221,8 @@ export default class LayoutConfig { result.push(AllKnownLayers.sharedLayers.get(defaultLayer)) } + + return {layers: result, extractAllNodes: exportAllNodes} } diff --git a/Models/ThemeConfig/LegacyJsonConvert.ts b/Models/ThemeConfig/LegacyJsonConvert.ts index a3496d0fd..818981436 100644 --- a/Models/ThemeConfig/LegacyJsonConvert.ts +++ b/Models/ThemeConfig/LegacyJsonConvert.ts @@ -77,6 +77,7 @@ export default class LegacyJsonConvert { delete config["iconSize"] delete config["rotation"] delete config["wayHandling"] + delete config["hideUnderlayingFeaturesMinPercentage"] for (const mapRenderingElement of config.mapRendering) { if (mapRenderingElement["iconOverlays"] !== undefined) { diff --git a/UI/Input/LocationInput.ts b/UI/Input/LocationInput.ts index 99c6f8dc7..92120c698 100644 --- a/UI/Input/LocationInput.ts +++ b/UI/Input/LocationInput.ts @@ -227,7 +227,7 @@ export default class LocationInput extends InputElement implements MinimapO leaflet.setMaxZoom(layer.max_zoom) leaflet.setMinZoom(self._minZoom ?? layer.max_zoom - 2) - leaflet.setZoom(layer.max_zoom - 1) + leaflet.setZoom(layer.max_zoom) }, [this.map.leafletMap])