From cb8efe0e8136a7f359337c2e67949de02e2e2cfe Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 1 Apr 2024 22:17:46 +0200 Subject: [PATCH] Fix error in showdataLayer --- src/UI/Map/ShowDataLayer.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/UI/Map/ShowDataLayer.ts b/src/UI/Map/ShowDataLayer.ts index 3079740b4..43ea13807 100644 --- a/src/UI/Map/ShowDataLayer.ts +++ b/src/UI/Map/ShowDataLayer.ts @@ -343,7 +343,7 @@ class LineRenderingLayer { promoteId: "id" }) const linelayer = this._layername + "_line" - map.addLayer({ + const layer: AddLayerObject = { source: this._layername, id: linelayer, type: "line", @@ -351,13 +351,17 @@ class LineRenderingLayer { "line-color": ["feature-state", "color"], "line-opacity": ["feature-state", "color-opacity"], "line-width": ["feature-state", "width"], - "line-offset": ["feature-state", "offset"], - "line-dasharray": this._config.dashArray?.split(" ")?.map(s => Number(s)) + "line-offset": ["feature-state", "offset"] }, layout: { "line-cap": "round" } - }) + } + if (this._config.dashArray) { + + layer.paint["line-dasharray"] = this._config.dashArray?.split(" ")?.map(s => Number(s)) ?? null + } + map.addLayer(layer) if (this._config.imageAlongWay) { this.addSymbolLayer(this._layername, this._config.imageAlongWay)