Reuse empty canvas

This commit is contained in:
Andreas Hocevar
2020-07-21 22:35:48 +02:00
parent c2376455ad
commit 8efb1eea43
+5 -1
View File
@@ -95,7 +95,11 @@ class CanvasLayerRenderer extends LayerRenderer {
context = canvas.getContext('2d'); context = canvas.getContext('2d');
} }
} }
if (context && context.canvas.style.transform === transform) { if (
context &&
(context.canvas.width === 0 ||
context.canvas.style.transform === transform)
) {
// Container of the previous layer renderer can be used. // Container of the previous layer renderer can be used.
this.container = target; this.container = target;
this.context = context; this.context = context;