From 3fbb1ae98818fce90df694b321f850edff60cc3a Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Tue, 5 Aug 2025 13:52:08 -0700 Subject: [PATCH] Use Offscreen Canvas to normalize --- frontend/apps/editor3d/app/src/Helpers/CanvasHelpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/apps/editor3d/app/src/Helpers/CanvasHelpers.ts b/frontend/apps/editor3d/app/src/Helpers/CanvasHelpers.ts index 5457215006..54a1265ef5 100644 --- a/frontend/apps/editor3d/app/src/Helpers/CanvasHelpers.ts +++ b/frontend/apps/editor3d/app/src/Helpers/CanvasHelpers.ts @@ -1,12 +1,12 @@ -export const normalizeCanvas = (canvas: HTMLCanvasElement, width: number, height: number): HTMLCanvasElement => { - const newCanvas = document.createElement("canvas"); +export const normalizeCanvas = (canvas: HTMLCanvasElement, width: number, height: number): OffscreenCanvas => { + const newCanvas = new OffscreenCanvas(width, height); newCanvas.width = width; newCanvas.height = height; const ctx = newCanvas.getContext("2d"); if (!ctx) { - throw new Error("Failed to get canvas context"); + throw new Error("Failed to get offscreen canvas context"); } ctx.imageSmoothingEnabled = true;