Fix opacity handling for tile and vector layers

This commit is contained in:
Andreas Hocevar
2021-09-15 19:18:04 +02:00
parent cb6995d71a
commit 2f5e6906b9
5 changed files with 31 additions and 12 deletions

View File

@@ -24,6 +24,7 @@ import {
intersects as intersectsExtent,
wrapX as wrapExtentX,
} from '../../extent.js';
import {cssOpacity} from '../../css.js';
import {
defaultOrder as defaultRenderOrder,
getTolerance as getRenderTolerance,
@@ -301,10 +302,10 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
this.postRender(context, frameState);
const opacity = layerState.opacity;
const opacity = cssOpacity(layerState.opacity);
const container = this.container;
if (opacity !== parseFloat(container.style.opacity)) {
container.style.opacity = opacity === 1 ? '' : String(opacity);
if (opacity !== container.style.opacity) {
container.style.opacity = opacity;
}
if (this.renderedRotation_ !== viewState.rotation) {