diff --git a/frontend/src/pages/SeeTogether.tsx b/frontend/src/pages/SeeTogether.tsx index 9102ef4e7..daa27336a 100644 --- a/frontend/src/pages/SeeTogether.tsx +++ b/frontend/src/pages/SeeTogether.tsx @@ -135,6 +135,13 @@ function SeeTogether() { } }; + const adjustMapDirection = () => { + if (!mapInstance) return; + + mapInstance.setBearing(0); + mapInstance.setPitch(0); + }; + useEffect(() => { setClusteredCoordinates(); @@ -145,6 +152,7 @@ function SeeTogether() { dragTimerIdRef.current = setTimeout(() => { setPrevCoordinates(); + adjustMapDirection(); }, 100); }; const onZoomEnd = (evt: evt) => { @@ -154,6 +162,7 @@ function SeeTogether() { zoomTimerIdRef.current = setTimeout(() => { setClusteredCoordinates(); + adjustMapDirection(); }, 100); }; diff --git a/frontend/src/pages/SelectedTopic.tsx b/frontend/src/pages/SelectedTopic.tsx index 8c92cd84e..4f19a6efb 100644 --- a/frontend/src/pages/SelectedTopic.tsx +++ b/frontend/src/pages/SelectedTopic.tsx @@ -76,6 +76,13 @@ function SelectedTopic() { setCoordinates((prev) => [...prev]); }; + const adjustMapDirection = () => { + if (!mapInstance) return; + + mapInstance.setBearing(0); + mapInstance.setPitch(0); + }; + useEffect(() => { getAndSetDataFromServer(); setTags([]); @@ -91,6 +98,7 @@ function SelectedTopic() { dragTimerIdRef.current = setTimeout(() => { setPrevCoordinates(); + adjustMapDirection(); }, 100); }; const onZoomEnd = (evt: evt) => { @@ -100,6 +108,7 @@ function SelectedTopic() { zoomTimerIdRef.current = setTimeout(() => { setClusteredCoordinates(); + adjustMapDirection(); }, 100); }; diff --git a/frontend/src/types/tmap.d.ts b/frontend/src/types/tmap.d.ts index fee0861db..a0b25c438 100644 --- a/frontend/src/types/tmap.d.ts +++ b/frontend/src/types/tmap.d.ts @@ -34,6 +34,8 @@ interface TMap { getBounds(): LatLngBounds; realToScreen(latLng: LatLng): Point; off(eventType: string, callback: (event: evt) => void): void; + setBearing(value: number): void; + setPitch(value: number): void; } interface Marker {