Skip to content

Commit

Permalink
fixes center on current location bug (#2147)
Browse files Browse the repository at this point in the history
Co-authored-by: Qiqi Zheng <[email protected]>
  • Loading branch information
qiqicodes and Qiqi Zheng authored Jun 2, 2024
1 parent df4a3f4 commit 13a6dba
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,18 @@ const ResultsMap = (
await loadMarkerIcons(map);
setMarkersLoaded(true);
setInteractiveLayerIds([MARKERS_LAYER_ID]);
}, []);
mapRef.current?.flyTo({
center: [
isListPanelOpen && !isMobile
? startIconCoordinates.longitude - 0.08
: startIconCoordinates.longitude,
isMobile
? startIconCoordinates.latitude - 0.03
: startIconCoordinates.latitude,
],
duration: 2000,
});
}, [startIconCoordinates, isListPanelOpen, isMobile]);

const onClick = (e) => {
mapRef.current?.flyTo({
Expand All @@ -108,7 +119,7 @@ const ResultsMap = (
],
duration: 2000,
});
dispatch({ type:'TOGGLE_LIST_PANEL'})
dispatch({ type: "TOGGLE_LIST_PANEL" });
if (!e.features || !e.features.length) {
dispatch({ type: "RESET_SELECTED_ORGANIZATION" });
} else if (stakeholders) {
Expand Down

0 comments on commit 13a6dba

Please sign in to comment.