From 49eae1aaff9bfb7dd58488e443700efd666796e5 Mon Sep 17 00:00:00 2001 From: Ib Green <7025232+ibgreen@users.noreply.github.com> Date: Mon, 17 Nov 2025 08:05:41 -0500 Subject: [PATCH] Use CanvasContext setter for device pixels --- modules/core/src/lib/deck.ts | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/modules/core/src/lib/deck.ts b/modules/core/src/lib/deck.ts index fc770d85bc0..89918b75efa 100644 --- a/modules/core/src/lib/deck.ts +++ b/modules/core/src/lib/deck.ts @@ -485,23 +485,8 @@ export default class Deck { // Update the animation loop this.animationLoop?.setProps(resolvedProps); - if ( - props.useDevicePixels !== undefined && - this.device?.canvasContext?.canvas instanceof HTMLCanvasElement - ) { - // TODO: It would be much cleaner if CanvasContext had a setProps method - this.device.canvasContext.props.useDevicePixels = props.useDevicePixels; - const canvas = this.device.canvasContext.canvas; - const entry = { - target: canvas, - contentBoxSize: [{inlineSize: canvas.clientWidth, blockSize: canvas.clientHeight}], - devicePixelContentBoxSize: [ - {inlineSize: canvas.clientWidth, blockSize: canvas.clientHeight} - ], - borderBoxSize: [{inlineSize: canvas.clientWidth, blockSize: canvas.clientHeight}] - }; - // Access the protected _handleResize method through the canvas context - (this.device.canvasContext as any)._handleResize([entry]); + if (props.useDevicePixels !== undefined && this.device?.canvasContext) { + this.device.canvasContext.setProps({useDevicePixels: props.useDevicePixels}); } // If initialized, update sub manager props