Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/render/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class Painter {
const sourceCache = sourceCaches[id];
coordsAscending[id] = sourceCache.getVisibleCoordinates();
coordsDescending[id] = coordsAscending[id].slice().reverse();
coordsDescendingSymbol[id] = sourceCache.getVisibleCoordinates(true).reverse();
coordsDescendingSymbol[id] = sourceCache.getVisibleCoordinates(true);
}

this.opaquePassCutoff = Infinity;
Expand Down
18 changes: 4 additions & 14 deletions src/source/source_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {Event, ErrorEvent, Evented} from '../util/evented.js';
import TileCache from './tile_cache.js';
import {keysDifference, values} from '../util/util.js';
import Context from '../gl/context.js';
import Point from '@mapbox/point-geometry';
import browser from '../util/browser.js';
import {OverscaledTileID} from './tile_id.js';
import assert from 'assert';
Expand Down Expand Up @@ -174,19 +173,10 @@ class SourceCache extends Evented {
return values((this._tiles: any)).map((tile: Tile) => tile.tileID).sort(compareTileId).map(id => id.key);
}

getRenderableIds(symbolLayer?: boolean): Array<number> {
getRenderableIds(allLayers?: boolean): Array<number> {
const renderables: Array<Tile> = [];
for (const id in this._tiles) {
if (this._isIdRenderable(+id, symbolLayer)) renderables.push(this._tiles[id]);
}
if (symbolLayer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

symbolLayer argument is no longer used so we should remove it from signature / calls.

return renderables.sort((a_: Tile, b_: Tile) => {
const a = a_.tileID;
const b = b_.tileID;
const rotatedA = (new Point(a.canonical.x, a.canonical.y))._rotate(this.transform.angle);
const rotatedB = (new Point(b.canonical.x, b.canonical.y))._rotate(this.transform.angle);
return a.overscaledZ - b.overscaledZ || rotatedB.y - rotatedA.y || rotatedB.x - rotatedA.x;
}).map(tile => tile.tileID.key);
if (this._isIdRenderable(+id, allLayers)) renderables.push(this._tiles[id]);
}
return renderables.map(tile => tile.tileID).sort(compareTileId).map(id => id.key);
}
Expand Down Expand Up @@ -841,8 +831,8 @@ class SourceCache extends Evented {
return tileResults;
}

getVisibleCoordinates(symbolLayer?: boolean): Array<OverscaledTileID> {
const coords = this.getRenderableIds(symbolLayer).map((id) => this._tiles[id].tileID);
getVisibleCoordinates(includeAllLayers?: boolean): Array<OverscaledTileID> {
const coords = this.getRenderableIds(includeAllLayers).map((id) => this._tiles[id].tileID);
for (const coord of coords) {
coord.projMatrix = this.transform.calculateProjMatrix(coord.toUnwrapped());
}
Expand Down