From 2b70e1d986a19291712bd224eb9e0d1c97c0f523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gonz=C3=A1lez=20Mu=C3=B1oz?= Date: Mon, 30 Oct 2023 10:27:56 +0100 Subject: [PATCH] sets individual opacity for conservation areas --- app/hooks/map/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/hooks/map/index.ts b/app/hooks/map/index.ts index 32484156ce..c221374a4a 100644 --- a/app/hooks/map/index.ts +++ b/app/hooks/map/index.ts @@ -252,23 +252,23 @@ export function useWDPAPreviewLayer({ }, render: { layers: [ - { + ...visibleCategories.map((id) => ({ type: 'fill', 'source-layer': 'layer0', layout: { visibility: 'visible', }, // wdpaIucnCategories are filtered in two steps as they are custom and WDPA. - // We have not way to separate them into two arrays but it would be ideal filter: [ 'any', - ['all', ['in', ['get', 'iucn_cat'], ['literal', visibleCategories]]], - ['all', ['in', ['get', 'id'], ['literal', visibleCategories]]], + ['all', ['in', ['get', 'iucn_cat'], ['literal', id]]], + ['all', ['in', ['get', 'id'], ['literal', id]]], ], paint: { 'fill-color': COLORS['wdpa-preview'], + 'fill-opacity': layerSettings[id]?.opacity || 1, }, - }, + })), { type: 'line', 'source-layer': 'layer0',