forked from MapComplete/MapComplete
		
	Allow a layer to be hidden by default; add some validation and behaviour tweaks
This commit is contained in:
		
							parent
							
								
									5f3c8dd1b4
								
							
						
					
					
						commit
						ea5bc7cbf4
					
				
					 7 changed files with 17 additions and 2 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
|  | @ -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 + ")" | ||||
|         } | ||||
|  |  | |||
|  | @ -221,6 +221,8 @@ export default class LayoutConfig { | |||
|             result.push(AllKnownLayers.sharedLayers.get(defaultLayer)) | ||||
|         } | ||||
| 
 | ||||
|        | ||||
|          | ||||
|         return {layers: result, extractAllNodes: exportAllNodes} | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue