forked from MapComplete/MapComplete
		
	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, | ||||
|             State.state.locationControl.map(l => l.zoom), | ||||
|             State.state.layoutToUse.data); | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 = { | ||||
|  |  | |||
|  | @ -21,7 +21,6 @@ export default class ShowDataLayer { | |||
| 
 | ||||
|     constructor(features: UIEventSource<{ feature: any, freshness: Date }[]>, | ||||
|                 leafletMap: UIEventSource<L.Map>, | ||||
|                 zoom: UIEventSource<number>, | ||||
|                 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; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue