From 858b89e896b50e0aeeabf79affbd66b13e0e8239 Mon Sep 17 00:00:00 2001 From: ftoromanoff Date: Wed, 27 Nov 2024 15:14:41 +0100 Subject: [PATCH] fix(Style): dont draw icon when size is 0 --- src/Core/Style.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Style.js b/src/Core/Style.js index 290f22cb08..0083a0574d 100644 --- a/src/Core/Style.js +++ b/src/Core/Style.js @@ -905,13 +905,13 @@ class Style { } } style.icon.source = sprites.source; - style.icon.size = readVectorProperty(layer.layout['icon-size']) || 1; + style.icon.size = readVectorProperty(layer.layout['icon-size']) ?? 1; const { color, opacity } = rgba2rgb(readVectorProperty(layer.paint['icon-color'], { type: 'color' })); // https://docs.mapbox.com/style-spec/reference/layers/#paint-symbol-icon-color if (iconImg.sdf) { style.icon.color = color; } - style.icon.opacity = readVectorProperty(layer.paint['icon-opacity']) || (opacity !== undefined && opacity); + style.icon.opacity = readVectorProperty(layer.paint['icon-opacity']) ?? (opacity !== undefined && opacity); } catch (err) { err.message = `VTlayer '${layer.id}': argument sprites must not be null when using layer.layout['icon-image']`; throw err;