Cluster styling tweaks, tweaks to NP

This commit is contained in:
Pieter Vander Vennet 2021-10-13 01:28:46 +02:00
parent 8f674b7976
commit adb36c2ffe
6 changed files with 30 additions and 32 deletions

View file

@ -1,6 +1,5 @@
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
import {LayerConfigJson} from "./LayerConfigJson";
import UnitConfigJson from "./UnitConfigJson";
/**
* Defines the entire theme.
@ -237,12 +236,6 @@ export interface LayoutConfigJson {
* If clustering is defined, defaults to 25
*/
minNeededElements?: number
/**
* By default, a box is shown indicating the number of features even if the map is zoomed out beyond the minzoom of the layer.
* This flag switches this behaviour to not show these boxes.
*/
hideClustersAboveMinZoom?: boolean;
},
/**

View file

@ -31,7 +31,6 @@ export default class LayoutConfig {
public readonly clustering?: {
maxZoom: number,
minNeededElements: number,
hideClustersAboveMinzoom: boolean
};
public readonly hideFromOverview: boolean;
public lockLocation: boolean | [[number, number], [number, number]];
@ -141,13 +140,16 @@ export default class LayoutConfig {
this.clustering = {
maxZoom: 16,
minNeededElements: 25,
hideClustersAboveMinzoom: false
};
if (json.clustering) {
if(json.clustering === false){
this.clustering = {
maxZoom: 0,
minNeededElements: 100000,
};
}else if (json.clustering) {
this.clustering = {
maxZoom: json.clustering.maxZoom ?? 18,
minNeededElements: json.clustering.minNeededElements ?? 25,
hideClustersAboveMinzoom: json.clustering.hideClustersAboveMinZoom ?? false
}
}