Remove broken dashArray-code, add check
This commit is contained in:
parent
b4941ace8f
commit
5a93910b6e
6 changed files with 10 additions and 100 deletions
|
@ -20,6 +20,9 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
this.color = this.tr("color", "#0000ff")
|
||||
this.width = this.tr("width", "7")
|
||||
this.dashArray = json.dashArray
|
||||
if(this.dashArray !== undefined && typeof this.dashArray !== "string"){
|
||||
throw "Invalid dasharray at "+context+"; this should be a string but is a "+typeof this.dashArray
|
||||
}
|
||||
this.lineCap = this.tr("lineCap", "round")
|
||||
this.fill = this.tr("fill", undefined)
|
||||
this.fillColor = this.tr("fillColor", undefined)
|
||||
|
|
|
@ -358,8 +358,13 @@ class LineRenderingLayer {
|
|||
}
|
||||
}
|
||||
if (this._config.dashArray) {
|
||||
try{
|
||||
|
||||
layer.paint["line-dasharray"] =
|
||||
this._config.dashArray?.split(" ")?.map((s) => Number(s)) ?? null
|
||||
}catch (e) {
|
||||
console.error(`Invalid dasharray in layer ${this._layername}:`, this._config.dashArray)
|
||||
}
|
||||
}
|
||||
map.addLayer(layer)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue