File tree Expand file tree Collapse file tree
test/integration/render-tests/symbol-elevation/z-elevation-with-sort-by-viewport-y-and-collision-boxes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,28 @@ class BuildingIndex {
114114 }
115115 }
116116
117+ /**
118+ * Returns true if any building layer tracked by this index is backed by
119+ * the source cache with the given `sourceCacheId`. Used to detect when a
120+ * fill-extrusion tile has finished loading so that a full label-placement
121+ * pass can be requested: symbol z-offsets depend on building heights, so
122+ * placement must re-run whenever new building data arrives.
123+ *
124+ * @param {string } sourceCacheId - The FQID of the source cache to check.
125+ * @returns {boolean } `true` if a tracked building layer uses this cache.
126+ * @example
127+ * if (buildingIndex.hasLayerForSourceCache(event.sourceCacheId)) { ... }
128+ */
129+ hasLayerForSourceCache ( sourceCacheId : string ) : boolean {
130+ for ( const { layer} of this . layers ) {
131+ const sourceCache = this . style . getLayerSourceCache ( layer ) ;
132+ if ( sourceCache && sourceCache . id === sourceCacheId ) {
133+ return true ;
134+ }
135+ }
136+ return false ;
137+ }
138+
117139 _mapCoordToOverlappingTile (
118140 tid : OverscaledTileID ,
119141 x : number ,
Original file line number Diff line number Diff line change @@ -4364,6 +4364,18 @@ export class Map extends Camera {
43644364 if ( elevationSource && event . sourceCacheId === elevationSource . id && this . style ) {
43654365 this . style . _setLabelPlacementStale ( ) ;
43664366 }
4367+ // Force a full label re-placement when a fill-extrusion (building)
4368+ // tile loads. Symbol z-offsets are computed from building heights
4369+ // during placement, so if a building tile arrives after the initial
4370+ // placement pass (a common race when the symbol source is GeoJSON
4371+ // but buildings come from a separate vector tile source) the
4372+ // collision boxes and elevated symbol positions will be wrong.
4373+ // Re-running placement after the building data arrives ensures
4374+ // symbols appear at the correct elevation.
4375+ if ( this . style && event . sourceCacheId &&
4376+ this . style . _buildingIndex . hasLayerForSourceCache ( event . sourceCacheId ) ) {
4377+ this . style . _requestFullLabelPlacement ( ) ;
4378+ }
43674379 this . painter . setTileLoadedFlag ( true ) ;
43684380 }
43694381 } ) ;
Original file line number Diff line number Diff line change 66 "width" : 256 ,
77 "height" : 256 ,
88 "operations" : [
9+ [" waitFrameReady" ]
910 ],
1011 "image-threshold" : [
1112 {"platform-tag-contains" : " " , "threshold" : 0.0035 }
You can’t perform that action at this time.
0 commit comments