From 9e0ee8723d49e3455866d7d6b7734855f5fe089d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 26 May 2024 19:08:48 -0400 Subject: [PATCH] Better layer click logic --- app/static/app/js/components/LayersControlLayer.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/static/app/js/components/LayersControlLayer.jsx b/app/static/app/js/components/LayersControlLayer.jsx index 8a0405a2d..765417881 100644 --- a/app/static/app/js/components/LayersControlLayer.jsx +++ b/app/static/app/js/components/LayersControlLayer.jsx @@ -109,7 +109,7 @@ export default class LayersControlLayer extends React.Component { } } - handleLayerClick = () => { + handleZoomToClick = () => { const { layer } = this.props; const bounds = layer.options.bounds !== undefined ? @@ -120,6 +120,14 @@ export default class LayersControlLayer extends React.Component { if (layer.getPopup()) layer.openPopup(); } + handleLayerClick = () => { + if (this.props.overlay){ + this.setState({visible: !this.state.visible}); + }else{ + this.setState({expanded: !this.state.expanded}); + } + } + handleSelectColor = e => { this.setState({colorMap: e.target.value}); } @@ -289,7 +297,7 @@ export default class LayersControlLayer extends React.Component { return (
{!this.props.overlay ? :
} -
{meta.name}
+
{meta.name}
{this.state.expanded ?