From 650c1a675c783179482338f449ca1202246916a0 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 6 Oct 2023 14:41:22 +0200 Subject: [PATCH] Fix: fix updating of styles --- src/UI/Map/ShowDataLayer.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/UI/Map/ShowDataLayer.ts b/src/UI/Map/ShowDataLayer.ts index 671b6478d..34ac01078 100644 --- a/src/UI/Map/ShowDataLayer.ts +++ b/src/UI/Map/ShowDataLayer.ts @@ -16,6 +16,7 @@ import { LayerConfigJson } from "../../Models/ThemeConfig/Json/LayerConfigJson" import PerLayerFeatureSourceSplitter from "../../Logic/FeatureSource/PerLayerFeatureSourceSplitter" import FilteredLayer from "../../Models/FilteredLayer" import SimpleFeatureSource from "../../Logic/FeatureSource/Sources/SimpleFeatureSource" +import { CLIENT_RENEG_LIMIT } from "tls"; class PointRenderingLayer { private readonly _config: PointRenderingConfig @@ -229,7 +230,10 @@ class LineRenderingLayer { const self = this features.features.addCallbackAndRunD(() => self.update(features.features)) - map.on("styledata", () => self.update(features.features)) + map.on("styledata", () => { + self._listenerInstalledOn.clear() + return self.update(features.features); + }) } public destruct(): void { @@ -406,13 +410,10 @@ class LineRenderingLayer { } else { const tags = this._fetchStore(id) this._listenerInstalledOn.add(id) - map.setFeatureState( - { source: this._layername, id }, - this.calculatePropsFor(feature.properties) - ) - tags.addCallbackD((properties) => { - if (!map.getLayer(this._layername)) { - return + tags.addCallbackAndRunD((properties) => { + // Make sure to use 'getSource' here, the layer names are different! + if(map.getSource(this._layername) === undefined){ + return true } map.setFeatureState( { source: this._layername, id },