Skip to content

Commit de81149

Browse files
committed
fixed(display): resolve excessive tile processing issue introduced in v0.40.0, boosting performance
Signed-off-by: Tim Deubler <tim.deubler@here.com>
1 parent 85ca28b commit de81149

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/display/src/displays/webgl/Display.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class WebGlDisplay extends BasicDisplay {
139139
private maxPitchGridTopWorld: number[];
140140
// vertical offset from top of the screen to the "horizon line" in screen pixels.
141141
protected horizonY: number;
142+
142143
constructor(mapEl: HTMLElement, renderTileSize: number, devicePixelRatio: number | string, renderOptions?: RenderOptions) {
143144
super(
144145
mapEl,
@@ -578,12 +579,15 @@ class WebGlDisplay extends BasicDisplay {
578579
}
579580

580581
protected pitchMapOffsetY(pitch: number = this.rx) {
581-
const {w, h} = this;
582-
const [x, maxPitchGridOffset] = this.maxPitchGridTopWorld;
583-
const matrix = this.render.updateMapGridMatrix(pitch, w, h);
584-
const y = this.project(x, maxPitchGridOffset, 0, 0, 0, matrix)[1];
585-
this.horizonY = (1 - y) * h / 2;
586-
return this.horizonY;
582+
let horizonY = 0;
583+
if (pitch > MAX_PITCH_GRID) {
584+
const {w, h} = this;
585+
const [x, maxPitchGridOffset] = this.maxPitchGridTopWorld;
586+
const matrix = this.render.updateMapGridMatrix(pitch, w, h);
587+
const y = this.project(x, maxPitchGridOffset, 0, 0, 0, matrix)[1];
588+
horizonY = (1 - y) * h / 2;
589+
}
590+
return this.horizonY = horizonY;
587591
}
588592

589593
protected viewport(dirty?: boolean) {

0 commit comments

Comments
 (0)