Performance improvement
This commit is contained in:
parent
5523603e70
commit
46b05d7410
3 changed files with 2 additions and 9 deletions
|
@ -419,7 +419,6 @@ export class InitUiElements {
|
||||||
})
|
})
|
||||||
|
|
||||||
new ShowDataLayer(source.features, State.state.leafletMap,
|
new ShowDataLayer(source.features, State.state.leafletMap,
|
||||||
State.state.locationControl.map(l => l.zoom),
|
|
||||||
State.state.layoutToUse.data);
|
State.state.layoutToUse.data);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Utils } from "../Utils";
|
import { Utils } from "../Utils";
|
||||||
|
|
||||||
export default class Constants {
|
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
|
// The user journey states thresholds when a new feature gets unlocked
|
||||||
public static userJourney = {
|
public static userJourney = {
|
||||||
|
|
|
@ -21,7 +21,6 @@ export default class ShowDataLayer {
|
||||||
|
|
||||||
constructor(features: UIEventSource<{ feature: any, freshness: Date }[]>,
|
constructor(features: UIEventSource<{ feature: any, freshness: Date }[]>,
|
||||||
leafletMap: UIEventSource<L.Map>,
|
leafletMap: UIEventSource<L.Map>,
|
||||||
zoom: UIEventSource<number>,
|
|
||||||
layoutToUse: LayoutConfig) {
|
layoutToUse: LayoutConfig) {
|
||||||
this._leafletMap = leafletMap;
|
this._leafletMap = leafletMap;
|
||||||
const self = this;
|
const self = this;
|
||||||
|
@ -44,13 +43,11 @@ export default class ShowDataLayer {
|
||||||
const feats = features.data.map(ff => ff.feature);
|
const feats = features.data.map(ff => ff.feature);
|
||||||
let geoLayer = self.CreateGeojsonLayer(feats)
|
let geoLayer = self.CreateGeojsonLayer(feats)
|
||||||
if (layoutToUse.clustering !== undefined) {
|
if (layoutToUse.clustering !== undefined) {
|
||||||
if (layoutToUse.clustering.maxZoom >= zoom.data) {
|
|
||||||
const cl = window["L"];
|
const cl = window["L"];
|
||||||
const cluster = cl.markerClusterGroup();
|
const cluster = cl.markerClusterGroup({ disableClusteringAtZoom: layoutToUse.clustering.maxZoom });
|
||||||
cluster.addLayer(geoLayer);
|
cluster.addLayer(geoLayer);
|
||||||
geoLayer = cluster;
|
geoLayer = cluster;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (oldGeoLayer) {
|
if (oldGeoLayer) {
|
||||||
mp.removeLayer(oldGeoLayer);
|
mp.removeLayer(oldGeoLayer);
|
||||||
|
@ -61,9 +58,6 @@ export default class ShowDataLayer {
|
||||||
|
|
||||||
features.addCallbackAndRun(() => update());
|
features.addCallbackAndRun(() => update());
|
||||||
leafletMap.addCallback(() => update());
|
leafletMap.addCallback(() => update());
|
||||||
zoom.map(z => (layoutToUse.clustering?.maxZoom ?? 0) >= z).addCallback(() => {
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
State.state.selectedElement.addCallback(feature => {
|
State.state.selectedElement.addCallback(feature => {
|
||||||
if(feature === undefined){
|
if(feature === undefined){
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue