From 18b1d2c4c35b09e909ae346086371b03aca73ce9 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 ef407ecdbc..7374c7b35c 100644 --- a/src/Core/Style.js +++ b/src/Core/Style.js @@ -922,13 +922,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;