From c3e8ddaf580f395366ff1fded0c9592a4485c701 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Mon, 17 Apr 2023 11:41:27 +0200 Subject: [PATCH] fix: improperly cache-busting on canvas scale instead of zoom (#6473) --- src/renderer/renderElement.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderer/renderElement.ts b/src/renderer/renderElement.ts index 486e52bd..21de70cb 100644 --- a/src/renderer/renderElement.ts +++ b/src/renderer/renderElement.ts @@ -88,6 +88,7 @@ export interface ExcalidrawElementWithCanvas { canvas: HTMLCanvasElement; theme: RenderConfig["theme"]; scale: number; + zoomValue: RenderConfig["zoom"]["value"]; canvasOffsetX: number; canvasOffsetY: number; boundTextElementVersion: number | null; @@ -202,6 +203,7 @@ const generateElementCanvas = ( canvas, theme: renderConfig.theme, scale, + zoomValue: zoom.value, canvasOffsetX, canvasOffsetY, boundTextElementVersion: getBoundTextElement(element)?.version || null, @@ -712,7 +714,7 @@ const generateElementWithCanvas = ( const prevElementWithCanvas = elementWithCanvasCache.get(element); const shouldRegenerateBecauseZoom = prevElementWithCanvas && - prevElementWithCanvas.scale !== zoom.value && + prevElementWithCanvas.zoomValue !== zoom.value && !renderConfig?.shouldCacheIgnoreZoom; const boundTextElementVersion = getBoundTextElement(element)?.version || null;