Skip to content

Commit

Permalink
DeckRenderer abort rendering when no views (#8065)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpalmer authored Aug 22, 2023
1 parent b64c5f9 commit 79f607d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/core/src/lib/deck-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default class DeckRenderer {
clearStack?: boolean;
clearCanvas?: boolean;
}) {
if (!opts.viewports.length) {
return;
}

const layerPass = this.drawPickingColors ? this.pickLayersPass : this.drawLayersPass;

const renderOpts: LayersPassRenderOptions = {
Expand Down
21 changes: 21 additions & 0 deletions test/modules/core/lib/deck.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ test('Deck#constructor', t => {
t.pass('Deck constructor did not throw');
});

test('Deck#no views', t => {
const deck = new Deck({
device,
width: 1,
height: 1,
autoResizeDrawingBuffer: device.canvasContext.htmlCanvas.clientWidth > 0,

viewState: {longitude: 0, latitude: 0, zoom: 0},
views: [],
layers: [],

onAfterRender: () => {
t.is(deck.deckRenderer.renderCount, 0, 'DeckRenderer did not render');
deck.finalize();
t.end();
}
});

t.pass('Deck constructor did not throw');
});

test('Deck#rendering, picking, logging', t => {
// Test logging functionalities
log.priority = 4;
Expand Down

0 comments on commit 79f607d

Please sign in to comment.