From f6b015757c6fa1bfd6e5c4274180dea1b7d2d9b1 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 3 Jul 2024 11:33:48 +0200 Subject: [PATCH] React to opacity changes --- packages/base/src/mainview/mainview.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/base/src/mainview/mainview.tsx b/packages/base/src/mainview/mainview.tsx index 4f234691..ff947d2d 100644 --- a/packages/base/src/mainview/mainview.tsx +++ b/packages/base/src/mainview/mainview.tsx @@ -293,6 +293,9 @@ export class MainView extends React.Component { layout: { visibility: layer.visible ? 'visible' : 'none' }, + paint: { + 'raster-opacity': layer.parameters?.opacity !== undefined ? layer.parameters.opacity : 1 + }, source: sourceId, minzoom: source.parameters?.minZoom || 0, maxzoom: source.parameters?.maxZoom || 24 @@ -346,6 +349,11 @@ export class MainView extends React.Component { 'visibility', layer.visible ? 'visible' : 'none' ); + this._Map.setPaintProperty( + id, + 'raster-opacity', + layer.parameters?.opacity !== undefined ? layer.parameters.opacity : 1 + ) } };