From 8d000f2e1718441435ece84221b66ce36dcdd4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bl=C3=A4sta=20Johnny?= Date: Wed, 12 Oct 2022 13:35:55 +0200 Subject: [PATCH] Skip if group is exclusive --- src/controls/legend.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/controls/legend.js b/src/controls/legend.js index 15371ab33..8129420cf 100644 --- a/src/controls/legend.js +++ b/src/controls/legend.js @@ -137,7 +137,14 @@ const Legend = function Legend(options = {}) { const layers = viewer.getLayers(); layers.forEach((el) => { if (!(['none', 'background'].includes(el.get('group')))) { - el.setVisible(true); + const group = viewer.getGroups().find((item) => item.name === el.get('group')); + if (typeof group !== 'undefined') { + if (!group.exclusive) { + el.setVisible(true); + } + } else { + el.setVisible(true); + } } }); };