diff --git a/src/render/painter.js b/src/render/painter.js index 88de16aec79..448b5652319 100644 --- a/src/render/painter.js +++ b/src/render/painter.js @@ -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; diff --git a/src/source/source_cache.js b/src/source/source_cache.js index 730a5f98beb..b9b2a93d63c 100644 --- a/src/source/source_cache.js +++ b/src/source/source_cache.js @@ -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'; @@ -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 { + getRenderableIds(allLayers?: boolean): Array { const renderables: Array = []; for (const id in this._tiles) { - if (this._isIdRenderable(+id, symbolLayer)) renderables.push(this._tiles[id]); - } - if (symbolLayer) { - 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); } @@ -841,8 +831,8 @@ class SourceCache extends Evented { return tileResults; } - getVisibleCoordinates(symbolLayer?: boolean): Array { - const coords = this.getRenderableIds(symbolLayer).map((id) => this._tiles[id].tileID); + getVisibleCoordinates(includeAllLayers?: boolean): Array { + const coords = this.getRenderableIds(includeAllLayers).map((id) => this._tiles[id].tileID); for (const coord of coords) { coord.projMatrix = this.transform.calculateProjMatrix(coord.toUnwrapped()); }