Skip to content

Commit

Permalink
fixup! Support for OffscreenCanvas in Web Workers playcanvas#2481
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfranzl committed Mar 21, 2023
1 parent 5c5db03 commit 7a7bbff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/platform/graphics/graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 7a7bbff

Please sign in to comment.