fix: improperly cache-busting on canvas scale instead of zoom (#6473)

This commit is contained in:
David Luzar 2023-04-17 11:41:27 +02:00 committed by GitHub
parent f640ddc2aa
commit c3e8ddaf58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;