From 4b996ca698b8335f08fa957f3e1297f9e2ae7582 Mon Sep 17 00:00:00 2001 From: ftoromanoff Date: Tue, 17 Oct 2023 15:15:56 +0200 Subject: [PATCH] corr mapBox 'icon-image' and sprites --- src/Core/Style.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Core/Style.js b/src/Core/Style.js index 6db260fa83..5023c55d8d 100644 --- a/src/Core/Style.js +++ b/src/Core/Style.js @@ -760,13 +760,12 @@ class Style { } // additional icon - const icon = readVectorProperty(layer.layout['icon-image']); - if (icon) { - this.icon.id = icon; - this.icon.source = sprites?.source || icon; - if (sprites) { - this.icon.cropValues = sprites[icon]; - } + const iconImg = readVectorProperty(layer.layout['icon-image']); + if (iconImg && sprites) { + this.icon.id = iconImg; + this.icon.source = sprites.source; + this.icon.cropValues = sprites[iconImg]; + this.icon.size = readVectorProperty(layer.layout['icon-size']) || 1; const { color, opacity } = rgba2rgb(readVectorProperty(layer.paint['icon-color'], { type: 'color' })); this.icon.color = color;