Merge pull request #12792 from ahocevar/no-render-work-when-no-features

Do not do any canvas work when there are no features to render
This commit is contained in:
Andreas Hocevar
2021-09-23 16:34:47 +00:00
committed by GitHub
2 changed files with 2 additions and 9 deletions

View File

@@ -97,11 +97,7 @@ class CanvasLayerRenderer extends LayerRenderer {
context = canvas.getContext('2d');
}
}
if (
context &&
(context.canvas.width === 0 ||
context.canvas.style.transform === transform)
) {
if (context && context.canvas.style.transform === transform) {
// Container of the previous layer renderer can be used.
this.container = target;
this.context = context;

View File

@@ -256,10 +256,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
(!replayGroup || replayGroup.isEmpty()) &&
(!declutterExecutorGroup || declutterExecutorGroup.isEmpty())
) {
if (!this.containerReused && canvas.width > 0) {
canvas.width = 0;
}
return this.container;
return null;
}
// resize and clear