Skip to content

Commit

Permalink
fix(Style): dont draw icon when size is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Nov 27, 2024
1 parent bb8f57d commit 18b1d2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Core/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 18b1d2c

Please sign in to comment.