Skip to content

Commit

Permalink
Fix TileLayer and Tile3DLayer visiblility (#6123)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Aug 24, 2021
1 parent 18a57b6 commit 437fc79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 1 addition & 9 deletions modules/geo-layers/src/tile-3d-layer/tile-3d-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class Tile3DLayer extends CompositeLayer {
filterSubLayer({layer, viewport}) {
const {tile} = layer.props;
const {id: viewportId} = viewport;
return tile.viewportIds.includes(viewportId);
return this.props.visible && tile.selected && tile.viewportIds.includes(viewportId);
}

_updateAutoHighlight(info) {
Expand Down Expand Up @@ -319,15 +319,7 @@ export default class Tile3DLayer extends CompositeLayer {
// props have changed, rerender layer
layer = this._getSubLayer(tile, layer);
layerCache.needsUpdate = false;
} else if (!layer.props.visible) {
// update layer visibility
// Still has GPU resource but visibility is turned off so turn it back on so we can render it.
layer = layer.clone({visible: true});
}
} else if (layer && layer.props.visible) {
// hide non-selected tiles
// Still in tileset cache but doesn't need to render this frame. Keep the GPU resource bound but don't render it.
layer = layer.clone({visible: false});
}
layerCache.layer = layer;
return layer;
Expand Down
4 changes: 1 addition & 3 deletions modules/geo-layers/src/tile-layer/tile-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export default class TileLayer extends CompositeLayer {
}

renderLayers() {
const {visible} = this.props;
return this.state.tileset.tiles.map(tile => {
const highlightedObjectIndex = this.getHighlightedObjectIndex(tile);
// cache the rendered layer in the tile
Expand All @@ -211,7 +210,6 @@ export default class TileLayer extends CompositeLayer {
...this.props,
id: `${this.id}-${tile.x}-${tile.y}-${tile.z}`,
data: tile.data,
visible,
_offset: 0,
tile
});
Expand All @@ -232,7 +230,7 @@ export default class TileLayer extends CompositeLayer {
}

filterSubLayer({layer}) {
return layer.props.tile.isVisible;
return this.props.visible && layer.props.tile.isVisible;
}
}

Expand Down

0 comments on commit 437fc79

Please sign in to comment.