Skip to content

Commit

Permalink
more robust handling of lost contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoes committed Mar 11, 2024
1 parent d7014a7 commit 7475740
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/GLViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,12 @@ export class GLViewer {
let regen = false;
if (this.renderer.isLost() && this.WIDTH > 0 && this.HEIGHT > 0) {
//create new context
this.container.querySelector('canvas').remove(); //remove existing
if(this.container.querySelector('canvas')) {
this.container.querySelector('canvas').remove(); //remove existing
if(this.config && this.config.canvas != undefined) {
delete this.config.canvas;
}
}
this.setupRenderer();
this.initContainer(this.container);
regen = true;
Expand Down

0 comments on commit 7475740

Please sign in to comment.