Add deploy script, fix realtime updating of the icons

This commit is contained in:
Pieter Vander Vennet 2020-07-16 17:24:18 +02:00
parent 07afc597c9
commit 7c1c9bc80a

View file

@ -110,16 +110,6 @@ export class FilteredLayer {
} }
public updateStyle() {
if (this._geolayer === undefined) {
return;
}
const self = this;
this._geolayer.setStyle(function (feature) {
return self._style(feature.properties);
});
}
public AddNewElement(element) { public AddNewElement(element) {
this._newElements.push(element); this._newElements.push(element);
console.log("Element added"); console.log("Element added");
@ -186,7 +176,15 @@ export class FilteredLayer {
onEachFeature: function (feature, layer) { onEachFeature: function (feature, layer) {
let eventSource = self._storage.addOrGetElement(feature); let eventSource = self._storage.addOrGetElement(feature);
eventSource.addCallback(function () { eventSource.addCallback(function () {
self.updateStyle(); if (layer.setIcon) {
layer.setIcon(self._style(feature.properties).icon)
} else {
console.log("UPdating", layer);
self._geolayer.setStyle(function (feature) {
return self._style(feature.properties);
});
}
}); });