Skip to content

Commit

Permalink
fixed(display): resolve excessive tile processing issue introduced in…
Browse files Browse the repository at this point in the history
… v0.40.0, boosting performance

Signed-off-by: Tim Deubler <tim.deubler@here.com>
  • Loading branch information
TerminalTim committed Dec 2, 2024
1 parent 85ca28b commit de81149
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/display/src/displays/webgl/Display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class WebGlDisplay extends BasicDisplay {
private maxPitchGridTopWorld: number[];
// vertical offset from top of the screen to the "horizon line" in screen pixels.
protected horizonY: number;

constructor(mapEl: HTMLElement, renderTileSize: number, devicePixelRatio: number | string, renderOptions?: RenderOptions) {
super(
mapEl,
Expand Down Expand Up @@ -578,12 +579,15 @@ class WebGlDisplay extends BasicDisplay {
}

protected pitchMapOffsetY(pitch: number = this.rx) {
const {w, h} = this;
const [x, maxPitchGridOffset] = this.maxPitchGridTopWorld;
const matrix = this.render.updateMapGridMatrix(pitch, w, h);
const y = this.project(x, maxPitchGridOffset, 0, 0, 0, matrix)[1];
this.horizonY = (1 - y) * h / 2;
return this.horizonY;
let horizonY = 0;
if (pitch > MAX_PITCH_GRID) {
const {w, h} = this;
const [x, maxPitchGridOffset] = this.maxPitchGridTopWorld;
const matrix = this.render.updateMapGridMatrix(pitch, w, h);
const y = this.project(x, maxPitchGridOffset, 0, 0, 0, matrix)[1];
horizonY = (1 - y) * h / 2;
}
return this.horizonY = horizonY;
}

protected viewport(dirty?: boolean) {
Expand Down

0 comments on commit de81149

Please sign in to comment.