diff --git a/src/symbol/cross_tile_symbol_index.js b/src/symbol/cross_tile_symbol_index.js index 609edcf70bb..b0bc86b56c3 100644 --- a/src/symbol/cross_tile_symbol_index.js +++ b/src/symbol/cross_tile_symbol_index.js @@ -259,7 +259,8 @@ class CrossTileSymbolIndex { for (const tile of tiles) { const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket); - if (!symbolBucket) continue; + if (!symbolBucket || styleLayer.id !== symbolBucket.layerIds[0]) + continue; if (!symbolBucket.bucketInstanceId) { symbolBucket.bucketInstanceId = ++this.maxBucketInstanceId; diff --git a/src/symbol/placement.js b/src/symbol/placement.js index 557401e4c25..c0e798c3af2 100644 --- a/src/symbol/placement.js +++ b/src/symbol/placement.js @@ -107,7 +107,7 @@ export class Placement { placeLayerTile(styleLayer: StyleLayer, tile: Tile, showCollisionBoxes: boolean, seenCrossTileIDs: { [string | number]: boolean }) { const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket); const bucketFeatureIndex = tile.latestFeatureIndex; - if (!symbolBucket || !bucketFeatureIndex) + if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.layerIds[0]) return; const collisionBoxArray = tile.collisionBoxArray; @@ -306,7 +306,7 @@ export class Placement { for (const tile of tiles) { const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket); - if (symbolBucket && tile.latestFeatureIndex) { + if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.layerIds[0]) { this.updateBucketOpacities(symbolBucket, seenCrossTileIDs, tile.collisionBoxArray); } } diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#6548/expected.png b/test/integration/render-tests/regressions/mapbox-gl-js#6548/expected.png new file mode 100644 index 00000000000..0aa9204c050 Binary files /dev/null and b/test/integration/render-tests/regressions/mapbox-gl-js#6548/expected.png differ diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#6548/style.json b/test/integration/render-tests/regressions/mapbox-gl-js#6548/style.json new file mode 100644 index 00000000000..1f80d158870 --- /dev/null +++ b/test/integration/render-tests/regressions/mapbox-gl-js#6548/style.json @@ -0,0 +1,62 @@ +{ + "version": 8, + "metadata": { + "test": { + "height": 64, + "width": 128 + } + }, + "center": [ + 0, + 0 + ], + "zoom": 0, + "sources": { + "point": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 0 + ] + } + } + ] + } + } + }, + "glyphs": "local://glyphs/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "text1", + "type": "symbol", + "source": "point", + "layout": { + "text-field": "Rendered Twice", + "text-font": [ + "Open Sans Semibold", + "Arial Unicode MS Bold" + ] + } + }, + { + "id": "text2", + "type": "symbol", + "source": "point", + "layout": { + "text-field": "Rendered Twice", + "text-font": [ + "Open Sans Semibold", + "Arial Unicode MS Bold" + ] + } + } + ] +} diff --git a/test/unit/symbol/cross_tile_symbol_index.js b/test/unit/symbol/cross_tile_symbol_index.js index 298e2437113..0e42dabb76b 100644 --- a/test/unit/symbol/cross_tile_symbol_index.js +++ b/test/unit/symbol/cross_tile_symbol_index.js @@ -16,7 +16,8 @@ function makeSymbolInstance(x, y, key) { function makeTile(tileID, symbolInstances) { const bucket = { - symbolInstances: symbolInstances + symbolInstances: symbolInstances, + layerIds: ['test'] }; return { tileID: tileID,