Skip to content

Commit

Permalink
fix tile stencilRef when it's not uniqueRef, maptalks/issues#677
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Jul 3, 2024
1 parent 6e944a3 commit aaab412
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/vt/src/layer/renderer/VectorTileLayerRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1104,18 +1104,21 @@ class VectorTileLayerRenderer extends maptalks.renderer.TileLayerCanvasRenderer
let ref = 1;
childTiles = childTiles.sort(sortByLevel);
for (let i = 0; i < childTiles.length; i++) {
this._addTileStencil(childTiles[i].info, uniqueRef ? ref : this.getTileLevelValue(childTiles[i].info.z, tileZoom));
const stencilRef = uniqueRef ? ref : this.getTileLevelValue(childTiles[i].info, tileZoom);
this._addTileStencil(childTiles[i].info, stencilRef);
ref++;
}
parentTiles = parentTiles.sort(sortByLevel);
for (let i = 0; i < parentTiles.length; i++) {
this._addTileStencil(parentTiles[i].info, uniqueRef ? ref : this.getTileLevelValue(parentTiles[i].info.z, tileZoom));
const stencilRef = uniqueRef ? ref : this.getTileLevelValue(parentTiles[i].info, tileZoom);
this._addTileStencil(parentTiles[i].info, stencilRef);
ref++;
}
//默认情况下瓦片是按照level从小到大排列的,所以倒序排列,让level较小的tile最后画(优先级最高)
const currentTiles = tiles.sort(sortByLevel);
for (let i = currentTiles.length - 1; i >= 0; i--) {
this._addTileStencil(currentTiles[i].info, uniqueRef ? ref : this.getTileLevelValue(currentTiles[i].info.z, tileZoom));
const stencilRef = uniqueRef ? ref : this.getTileLevelValue(currentTiles[i].info, tileZoom);
this._addTileStencil(currentTiles[i].info, stencilRef);
ref++;
}

Expand Down

0 comments on commit aaab412

Please sign in to comment.