Allow a layer to be hidden by default; add some validation and behaviour tweaks

This commit is contained in:
Pieter Vander Vennet 2021-12-03 02:29:25 +01:00
parent 5f3c8dd1b4
commit ea5bc7cbf4
7 changed files with 17 additions and 2 deletions

View file

@ -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 + ")"
}