From 594e8e976e3fec8af50d207a31d7feb6106c304c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Tue, 27 Sep 2022 09:24:20 +0200 Subject: [PATCH] Globe: Check for renderer on resize --- src/modules/globe/index.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/modules/globe/index.ts b/src/modules/globe/index.ts index fe6daed..55e38fc 100644 --- a/src/modules/globe/index.ts +++ b/src/modules/globe/index.ts @@ -261,12 +261,14 @@ export class Globe { * Resize method */ resize () { - this.width = this.el.offsetWidth - this.height = this.el.offsetHeight - this.renderer.setSize(this.width, this.height) - this.camera.perspective({ - aspect: this.gl.canvas.width / this.gl.canvas.height - }) + if (this.renderer) { + this.width = this.el.offsetWidth + this.height = this.el.offsetHeight + this.renderer.setSize(this.width, this.height) + this.camera.perspective({ + aspect: this.gl.canvas.width / this.gl.canvas.height + }) + } }