Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not do any canvas work when there are no features to render #12792

Merged
merged 1 commit into from Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/ol/renderer/canvas/Layer.js
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/ol/renderer/canvas/VectorLayer.js
Expand Up @@ -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
Expand Down