Performance optimization, icon anchor position

This commit is contained in:
Pieter Vander Vennet 2020-07-27 00:14:34 +02:00
parent 5f0243384c
commit 21280fd156
2 changed files with 24 additions and 13 deletions

View file

@ -228,13 +228,12 @@ export class FilteredLayer {
} }
let eventSource = self._storage.addOrGetElement(feature); let eventSource = self._storage.addOrGetElement(feature);
const uiElement = self._showOnPopup(eventSource, feature); const uiElement = self._showOnPopup(eventSource, feature);
const popup = L.popup().setContent(uiElement.Render()); const popup = L.popup({}, marker).setContent(uiElement.Render());
uiElement.Update(); marker.bindPopup(popup)
marker.bindPopup(popup); .on("popupopen", (popup) => {
marker.on("click", () => {
console.log("Popup opened");
uiElement.Activate(); uiElement.Activate();
}) // TODO FIX uiElement.Update();
});
return marker; return marker;
}, },

View file

@ -46,15 +46,27 @@ export class LayerUpdater {
} }
private handleData(geojson: any) { private handleData(geojson: any) {
this.runningQuery.setData(false); const self = this;
function renderLayers(layers: FilteredLayer[]) {
for (const layer of this._layers) { if (layers.length === 0) {
geojson = layer.SetApplicableData(geojson); self.runningQuery.setData(false);
}
if (geojson.features.length > 0) { if (geojson.features.length > 0) {
console.log("Got some leftovers: ", geojson) console.log("Got some leftovers: ", geojson)
} }
return;
}
window.setTimeout(() => {
const layer = layers[0];
const rest = layers.slice(1, layers.length);
geojson = layer.SetApplicableData(geojson);
renderLayers(rest);
}, 50)
}
renderLayers(this._layers);
} }
private _failCount = 0; private _failCount = 0;