Skip to content

Commit 1bfff55

Browse files
ibesoragithub-actions[bot]
authored andcommitted
Fix appearances with no icon-size using the default value instead of the layout-defined one
GitOrigin-RevId: 2d2b11f932847a69a134362039c6cd562e6e01dc
1 parent 51fc1a6 commit 1bfff55

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/data/bucket/symbol_bucket.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,14 @@ class SymbolBucket implements Bucket {
675675
evaluationFeature: EvaluationFeature,
676676
canonical: CanonicalTileID,
677677
availableImages: Array<ImageId>,
678-
iconScaleFactor: number
678+
iconScaleFactor: number,
679+
layoutIconSize: number
679680
): number {
681+
// If appearance doesn't define icon-size, use layout value
682+
if (!activeAppearance.hasProperty('icon-size')) {
683+
return layoutIconSize * iconScaleFactor;
684+
}
685+
680686
let effectiveIconSize = 1;
681687
const unevaluatedIconSize = activeAppearance.getUnevaluatedProperties()._values['icon-size'];
682688
const iconSizeData = getSizeData(this.zoom, unevaluatedIconSize, this.worldview);
@@ -980,7 +986,9 @@ class SymbolBucket implements Bucket {
980986
}
981987

982988
if (icon) {
983-
const unevaluatedIconSize = unevaluatedProperties._values['icon-size'] || layer._unevaluatedLayout._values['icon-size'];
989+
const unevaluatedIconSize = appearance.hasProperty('icon-size') ?
990+
unevaluatedProperties._values['icon-size'] :
991+
layer._unevaluatedLayout._values['icon-size'];
984992
const iconSizeData = getSizeData(this.zoom, unevaluatedIconSize, this.worldview);
985993
const imageVariant = getScaledImageVariant(icon, iconSizeData, unevaluatedIconSize, canonical, this.zoom, symbolFeature, this.pixelRatio, iconScaleFactor, this.worldview);
986994
iconPrimary = imageVariant.iconPrimary;
@@ -1055,7 +1063,8 @@ class SymbolBucket implements Bucket {
10551063
evaluationFeature,
10561064
canonical,
10571065
availableImages,
1058-
iconScaleFactor
1066+
iconScaleFactor,
1067+
layoutIconSize
10591068
);
10601069
const newSizeX = 0; // Unused in appearances
10611070
const newSizeY = (Math.min(MAX_PACKED_SIZE, Math.round(effectiveIconSize * SIZE_PACK_FACTOR)) << 1) + 1; // pack isAppearance flag in lowest bit

test/ignores/all.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ const skip = [
156156
// Broken - https://mapbox.atlassian.net/browse/GLJS-1583
157157
"render-tests/appearance/line-placement/icon-appears-below",
158158

159-
// Broken in similar way as gl-native https://mapbox.atlassian.net/browse/MAPSNAT-3462
160-
"render-tests/appearance/no-icon-size-in-appearance-non-default-layout-icon-size",
161-
162159
// Mapbox-gl-js does not support tile-mode
163160
"render-tests/icon-text-fit/text-variable-anchor-tile-map-mode",
164161
"render-tests/map-mode/tile",

0 commit comments

Comments
 (0)