fix: 子图层过滤

This commit is contained in:
lzxue 2022-10-18 23:52:09 +08:00
parent 02bae0265f
commit 929ae5ce3d
2 changed files with 4 additions and 3 deletions

View File

@ -16,8 +16,6 @@ export class TileLayerService {
constructor({ rendererService, parent }: TileLayerServiceOptions) {
this.rendererService = rendererService;
this.parent = parent;
console.log(parent.masks)
}
get tiles():Tile[] {
return this.tiles;
@ -49,6 +47,7 @@ export class TileLayerService {
updateTileVisible(sourceTile: SourceTile) {
const tile = this.getTile(sourceTile.key);
tile?.updateVisible(sourceTile.isVisible);
}
render() {
@ -64,7 +63,8 @@ export class TileLayerService {
// mask.hooks.afterRender.call();
// })
// TODO 渲染排序
this._tiles.map((tile: Tile) => {
this._tiles.filter((t)=>t.visible && t.isLoaded)
.map((tile: Tile) => {
const layers = tile.getLayers();
layers.forEach(async (layer: ILayer) => {
await layer.hooks.beforeRenderData.promise();

View File

@ -153,6 +153,7 @@ export class Base {
this.tileLayerService.addTile(tileLayer);
this.layerService.reRender()
} else {
this.tileLayerService.updateTileVisible(tile);
this.layerService.reRender()
}