Skip to content

Commit

Permalink
Fix whats here turning off functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalcengio authored and micheal-w-wells committed Dec 29, 2023
1 parent 5374184 commit deb9b66
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions appv2/src/UI/Map/Buttons/WhatsHereButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -42,6 +43,9 @@ export const WhatsHereButton = (props) => {
<IconButton
onClick={() => {
dispatch({ type: MAP_TOGGLE_WHATS_HERE, payload: {toggle: !whatsHere.toggle} });
if (whatsHere.toggle) {
history.goBack();
}
}}
className={
'leaflet-control-zoom leaflet-bar leaflet-control ' +
Expand Down Expand Up @@ -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 <></>;
};

0 comments on commit deb9b66

Please sign in to comment.