diff --git a/appv2/src/UI/Map/Buttons/WhatsHereButton.tsx b/appv2/src/UI/Map/Buttons/WhatsHereButton.tsx index 50ba7d7ed..e758c864b 100644 --- a/appv2/src/UI/Map/Buttons/WhatsHereButton.tsx +++ b/appv2/src/UI/Map/Buttons/WhatsHereButton.tsx @@ -15,6 +15,7 @@ import { useHistory } from "react-router"; export const WhatsHereButton = (props) => { const map = useMap(); const dispatch = useDispatch(); + const history = useHistory(); const whatsHere = useSelector((state: any) => state.Map?.whatsHere); const darkTheme = useSelector((state: any) => state.UserSettings?.darkTheme) const toolClass = toolStyles(); @@ -42,6 +43,9 @@ export const WhatsHereButton = (props) => { { dispatch({ type: MAP_TOGGLE_WHATS_HERE, payload: {toggle: !whatsHere.toggle} }); + if (whatsHere.toggle) { + history.goBack(); + } }} className={ 'leaflet-control-zoom leaflet-bar leaflet-control ' + @@ -93,5 +97,12 @@ export const WhatsHereDrawComponent = (props) => { } }); + useMapEvent('click', (e) => { + if ((whatsHere as any).toggle && (whatsHere as any)?.feature) { + dispatch({ type: MAP_TOGGLE_WHATS_HERE, payload: {toggle: !whatsHere.toggle} }); + history.goBack(); + } + }); + return <>; }; \ No newline at end of file