From 46b05d74105a17ec1d944095fcf02fc9bd31fb0a Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 4 Jan 2021 23:46:35 +0100 Subject: [PATCH] Performance improvement --- InitUiElements.ts | 1 - Models/Constants.ts | 2 +- UI/ShowDataLayer.ts | 8 +------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/InitUiElements.ts b/InitUiElements.ts index ceed80f..c12ca08 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -419,7 +419,6 @@ export class InitUiElements { }) new ShowDataLayer(source.features, State.state.leafletMap, - State.state.locationControl.map(l => l.zoom), State.state.layoutToUse.data); diff --git a/Models/Constants.ts b/Models/Constants.ts index b13c38c..db73d26 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -1,7 +1,7 @@ import { Utils } from "../Utils"; export default class Constants { - public static vNumber = "0.2.7-rc4"; + public static vNumber = "0.2.7-rc5"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/UI/ShowDataLayer.ts b/UI/ShowDataLayer.ts index f3e8586..da30a03 100644 --- a/UI/ShowDataLayer.ts +++ b/UI/ShowDataLayer.ts @@ -21,7 +21,6 @@ export default class ShowDataLayer { constructor(features: UIEventSource<{ feature: any, freshness: Date }[]>, leafletMap: UIEventSource, - zoom: UIEventSource, layoutToUse: LayoutConfig) { this._leafletMap = leafletMap; const self = this; @@ -44,12 +43,10 @@ export default class ShowDataLayer { const feats = features.data.map(ff => ff.feature); let geoLayer = self.CreateGeojsonLayer(feats) if (layoutToUse.clustering !== undefined) { - if (layoutToUse.clustering.maxZoom >= zoom.data) { const cl = window["L"]; - const cluster = cl.markerClusterGroup(); + const cluster = cl.markerClusterGroup({ disableClusteringAtZoom: layoutToUse.clustering.maxZoom }); cluster.addLayer(geoLayer); geoLayer = cluster; - } } if (oldGeoLayer) { @@ -61,9 +58,6 @@ export default class ShowDataLayer { features.addCallbackAndRun(() => update()); leafletMap.addCallback(() => update()); - zoom.map(z => (layoutToUse.clustering?.maxZoom ?? 0) >= z).addCallback(() => { - update(); - }); State.state.selectedElement.addCallback(feature => { if(feature === undefined){ return;