From 24a64e744b66ae1c330780abc055c5083c46031a Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 26 May 2024 19:29:08 -0400 Subject: [PATCH] Fix annotations layer state --- .../app/js/components/LayersControlAnnotations.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/static/app/js/components/LayersControlAnnotations.jsx b/app/static/app/js/components/LayersControlAnnotations.jsx index 5341a4ccc..f49f275e7 100644 --- a/app/static/app/js/components/LayersControlAnnotations.jsx +++ b/app/static/app/js/components/LayersControlAnnotations.jsx @@ -15,7 +15,7 @@ class AnnotationLayer extends React.Component{ super(props); this.state = { - visible: true + visible: !!props.layer._map } } @@ -69,7 +69,7 @@ class AnnotationLayer extends React.Component{ return (
-
{meta.name}
+
{meta.name}
); } @@ -90,8 +90,16 @@ export default class LayersControlAnnotations extends React.Component { constructor(props){ super(props); + let visible = false; + for (let i = 0; i < props.layers.length; i++){ + if (props.layers[i]._map){ + visible = true; + break; + } + } + this.state = { - visible: props.visible, + visible, expanded: props.expanded };