Skip to content

Commit

Permalink
ON-40851 # fixed ArcGIS web map layer panel showing if map is loaded …
Browse files Browse the repository at this point in the history
…on another page
  • Loading branch information
aaronroworth committed May 30, 2024
1 parent 5549f89 commit 5e0ca17
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- injected options referenced from another page not being injected into HTML
- ArcGIS web map layer panel showing if map is loaded on another page

### Added

Expand Down
32 changes: 18 additions & 14 deletions src/components/ArcGISWebMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function FormElementArcGISWebMap({ element, id, ...props }: Props) {
content: layerList,
expanded: element.showLayerPanel,
mode: 'floating',
visible: false,
})

view.ui.add(layerPanelRef.current, 'top-right')
Expand All @@ -91,6 +92,7 @@ function FormElementArcGISWebMap({ element, id, ...props }: Props) {
view,
content: baseMapGallery,
mode: 'floating',
visible: false,
})

view.ui.add(mapGalleryPanelRef.current, 'bottom-right')
Expand All @@ -116,22 +118,24 @@ function FormElementArcGISWebMap({ element, id, ...props }: Props) {
}, [element])

React.useEffect(() => {
if (isPageVisible) {
if (layerPanelRef.current) {
layerPanelRef.current.visible = true
}
if (mapGalleryPanelRef.current) {
mapGalleryPanelRef.current.visible = true
}
} else if (!isPageVisible) {
if (layerPanelRef.current) {
layerPanelRef.current.visible = false
}
if (mapGalleryPanelRef.current) {
mapGalleryPanelRef.current.visible = false
if (!isLoading) {
if (isPageVisible) {
if (layerPanelRef.current) {
layerPanelRef.current.visible = true
}
if (mapGalleryPanelRef.current) {
mapGalleryPanelRef.current.visible = true
}
} else if (!isPageVisible) {
if (layerPanelRef.current) {
layerPanelRef.current.visible = false
}
if (mapGalleryPanelRef.current) {
mapGalleryPanelRef.current.visible = false
}
}
}
}, [isPageVisible])
}, [isPageVisible, isLoading])

if (loadError) {
return (
Expand Down

0 comments on commit 5e0ca17

Please sign in to comment.