forked from MapComplete/MapComplete
More work on clustering, more or less finished
This commit is contained in:
parent
a3c16d6297
commit
215aebce19
8 changed files with 276 additions and 185 deletions
|
@ -228,8 +228,8 @@ export interface LayoutConfigJson {
|
|||
*/
|
||||
maxZoom?: number,
|
||||
/**
|
||||
* The number of elements that should be showed (in total) before clustering starts to happen.
|
||||
* If clustering is defined, defaults to 0
|
||||
* The number of elements per tile needed to start clustering
|
||||
* If clustering is defined, defaults to 25
|
||||
*/
|
||||
minNeededElements?: number
|
||||
},
|
||||
|
|
|
@ -129,17 +129,12 @@ export default class LayoutConfig {
|
|||
|
||||
this.clustering = {
|
||||
maxZoom: 16,
|
||||
minNeededElements: 500
|
||||
minNeededElements: 25
|
||||
};
|
||||
if (json.clustering) {
|
||||
this.clustering = {
|
||||
maxZoom: json.clustering.maxZoom ?? 18,
|
||||
minNeededElements: json.clustering.minNeededElements ?? 1
|
||||
}
|
||||
for (const layer of this.layers) {
|
||||
if (layer.wayHandling !== LayerConfig.WAYHANDLING_CENTER_ONLY) {
|
||||
console.debug("WARNING: In order to allow clustering, every layer must be set to CENTER_ONLY. Layer", layer.id, "does not respect this for layout", this.id);
|
||||
}
|
||||
minNeededElements: json.clustering.minNeededElements ?? 25
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue