Attempt at implementing #4036

This commit is contained in:
zsviczian 2023-04-03 12:05:19 +02:00 committed by GitHub
parent d2b8f4d2f8
commit 7d1efb7f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -422,6 +422,11 @@ const generateElementShape = (
// `null` indicates no rc shape applicable for this element type
// (= do not generate anything)
if (shape === undefined) {
const prevElementWithCanvas = elementWithCanvasCache.get(element);
if(prevElementWithCanvas?.canvas) {
prevElementWithCanvas.canvas.width = 0;
prevElementWithCanvas.canvas.height = 0;
}
elementWithCanvasCache.delete(element);
switch (element.type) {
@ -685,7 +690,10 @@ const generateElementWithCanvas = (
zoom,
renderConfig,
);
if(prevElementWithCanvas?.canvas) {
prevElementWithCanvas.canvas.width = 0;
prevElementWithCanvas.canvas.height = 0;
}
elementWithCanvasCache.set(element, elementWithCanvas);
return elementWithCanvas;