Skip to content

Commit 2398922

Browse files
dcojgithub-actions[bot]
authored andcommitted
Fix for failing unit test
GitOrigin-RevId: bc3e7e3de55005e77d067ec788e2d94a9d48daa3
1 parent 602ff02 commit 2398922

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

modules/hd_main_esm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import {warnOnce} from '../src/util/util';
22
import {updateFrcCoverageFadeRange} from '../3d-style/style/frc_coverage_eager';
3+
import {buildElevationRequestParams} from '../3d-style/source/elevation_coverage_snapshot';
34

45
import type {HD as HDType} from './hd_main_imports';
56

67
// `updateFrcCoverageFadeRange` is pure config-walking — it must run before the first
78
// tile request to set `painter.frcCoverageFadeRange` (read by `vector_tile_source`
89
// when building worker tile params). Importing it statically pulls it into core.
10+
// `buildElevationRequestParams` is likewise needed before the first tile load so that
11+
// cross-source elevation stubs are generated even when the full HD chunk hasn't loaded yet.
912
// Rest of HD stays lazy.
1013
export const HD: Partial<typeof HDType> = {
1114
updateFrcCoverageFadeRange,
15+
buildElevationRequestParams,
1216
};
1317

1418
export async function prepareHD() {

src/source/vector_tile_source.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,9 @@ class VectorTileSource extends Evented<SourceEvents> implements ISource<'vector'
346346

347347
// Enable cross-source elevation while HD is loading so unmatched ids defer (not parse flat).
348348
// Inert on non-elevation styles (no hd-road-markup buckets).
349+
const crossSourceElevationActive = !!(this.map.style && this.map.style._crossSourceElevationActive);
349350
const crossSourceElevationEnabled = !!(this.map.style &&
350-
(this.map.style._crossSourceElevationActive || !HD.loaded));
351+
(crossSourceElevationActive || !HD.loaded));
351352

352353
const params: WorkerSourceVectorTileRequest = {
353354
request,
@@ -391,7 +392,7 @@ class VectorTileSource extends Evented<SourceEvents> implements ISource<'vector'
391392
terrainEnabled: !!(this.map.style && this.map.style.terrain),
392393
crossSourceElevationEnabled,
393394
elevation: HD.buildElevationRequestParams ?
394-
HD.buildElevationRequestParams(this.map, tile, crossSourceElevationEnabled) : null,
395+
HD.buildElevationRequestParams(this.map, tile, crossSourceElevationActive) : null,
395396
brightness: this.map.style ? (this.map.style.getBrightness() || 0.0) : 0.0,
396397
extraShadowCaster: tile.isExtraShadowCaster,
397398
tessellationStep: this.map._tessellationStep,

test/unit/source/elevation_coverage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,9 @@ describe('HD elevation eager/lazy split (hd_main_esm)', () => {
796796
const {HD, prepareHD} = mod;
797797

798798
expect(typeof HD.updateFrcCoverageFadeRange).toBe('function');
799+
expect(typeof HD.buildElevationRequestParams).toBe('function');
799800
expect(HD.loaded).toBeFalsy();
800801
expect(HD.setupAndUpdateElevationCoverage).toBeUndefined();
801-
expect(HD.buildElevationRequestParams).toBeUndefined();
802802
expect(HD.HdElevationState).toBeUndefined();
803803
expect(HD.updateElevationCoverage).toBeUndefined();
804804
expect(HD.updateHdElevationSourceCache).toBeUndefined();

0 commit comments

Comments
 (0)