Update backgrounds when function returns a different color

This commit is contained in:
Andreas Hocevar
2022-04-09 10:47:53 +02:00
parent c03f58fe5d
commit cbb18ab805
2 changed files with 27 additions and 4 deletions

View File

@@ -155,7 +155,8 @@ class CanvasLayerRenderer extends LayerRenderer {
target.style.opacity === '' &&
opacity === 1 &&
(!opt_backgroundColor ||
(target.style.backgroundColor &&
(target &&
target.style.backgroundColor &&
equals(
asArray(target.style.backgroundColor),
asArray(opt_backgroundColor)
@@ -184,9 +185,6 @@ class CanvasLayerRenderer extends LayerRenderer {
style.position = 'absolute';
style.width = '100%';
style.height = '100%';
if (opt_backgroundColor) {
style.backgroundColor = opt_backgroundColor;
}
context = createCanvasContext2D();
const canvas = context.canvas;
container.appendChild(canvas);
@@ -197,6 +195,13 @@ class CanvasLayerRenderer extends LayerRenderer {
this.container = container;
this.context = context;
}
if (
!this.containerReused &&
opt_backgroundColor &&
!this.container.style.backgroundColor
) {
this.container.style.backgroundColor = opt_backgroundColor;
}
}
/**