Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 858b89e

Browse files
committed
fix(Style): dont draw icon when size is 0
1 parent d1abe5a commit 858b89e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Core/Style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,13 +905,13 @@ class Style {
905905
}
906906
}
907907
style.icon.source = sprites.source;
908-
style.icon.size = readVectorProperty(layer.layout['icon-size']) || 1;
908+
style.icon.size = readVectorProperty(layer.layout['icon-size']) ?? 1;
909909
const { color, opacity } = rgba2rgb(readVectorProperty(layer.paint['icon-color'], { type: 'color' }));
910910
// https://docs.mapbox.com/style-spec/reference/layers/#paint-symbol-icon-color
911911
if (iconImg.sdf) {
912912
style.icon.color = color;
913913
}
914-
style.icon.opacity = readVectorProperty(layer.paint['icon-opacity']) || (opacity !== undefined && opacity);
914+
style.icon.opacity = readVectorProperty(layer.paint['icon-opacity']) ?? (opacity !== undefined && opacity);
915915
} catch (err) {
916916
err.message = `VTlayer '${layer.id}': argument sprites must not be null when using layer.layout['icon-image']`;
917917
throw err;

0 commit comments

Comments
 (0)