From 0fe8e088430ab9f71552170d732c7199a332b1d8 Mon Sep 17 00:00:00 2001 From: Jose Buitron Date: Wed, 15 May 2024 15:47:53 -0500 Subject: [PATCH] fix: Improved opacity function --- .../visualization/components/VisualizationMapLayer.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sharedData/visualization/components/VisualizationMapLayer.js b/src/sharedData/visualization/components/VisualizationMapLayer.js index 00cbb138d1..ea00619800 100644 --- a/src/sharedData/visualization/components/VisualizationMapLayer.js +++ b/src/sharedData/visualization/components/VisualizationMapLayer.js @@ -30,15 +30,14 @@ const DEFAULT_MARKER_OPACITY = 1; export const LAYER_TYPES = ['markers', 'polygons-outline', 'polygons-fill']; +// Opacity range between 0 - 100 export const getLayerOpacity = (type, visualizationConfig) => { + if (type !== 'polygons-fill') { + return DEFAULT_MARKER_OPACITY; + } const opacity = visualizationConfig?.visualizeConfig?.opacity || DEFAULT_MARKER_OPACITY; - switch (type) { - case 'polygons-fill': - return opacity / 100; - default: - return DEFAULT_MARKER_OPACITY; - } + return opacity / 100; }; const getSourceBounds = async (map, sourceId) => {