From 7a7bbffa2ec510924744ad4704cfb4705d072dd8 Mon Sep 17 00:00:00 2001 From: Michael Franzl Date: Tue, 21 Mar 2023 18:54:33 +0100 Subject: [PATCH] fixup! Support for OffscreenCanvas in Web Workers #2481 --- src/platform/graphics/graphics-device.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/platform/graphics/graphics-device.js b/src/platform/graphics/graphics-device.js index d089c61e685..34779920500 100644 --- a/src/platform/graphics/graphics-device.js +++ b/src/platform/graphics/graphics-device.js @@ -157,6 +157,16 @@ class GraphicsDevice extends EventHandler { flags: CLEARFLAG_COLOR | CLEARFLAG_DEPTH }; + /** + * The current client rect. + * + * @type {{ width: number, height: number }} + */ + clientRect = { + width: 0, + height: 0 + }; + static EVENT_RESIZE = 'resizecanvas'; constructor(canvas) { @@ -444,7 +454,8 @@ class GraphicsDevice extends EventHandler { } updateClientRect() { - this.clientRect = new DOMRect(0, 0, this.canvas.width, this.canvas.height); + this.clientRect.width = this.canvas.width; + this.clientRect.height = this.canvas.height; } /**