Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] Refactor 지도 회전 및 기울기 이벤트 시 지도를 원래대로 조정 #623

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/src/pages/SeeTogether.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ function SeeTogether() {
}
};

const adjustMapDirection = () => {
if (!mapInstance) return;

mapInstance.setBearing(0);
mapInstance.setPitch(0);
};

useEffect(() => {
setClusteredCoordinates();

Expand All @@ -145,6 +152,7 @@ function SeeTogether() {

dragTimerIdRef.current = setTimeout(() => {
setPrevCoordinates();
adjustMapDirection();
}, 100);
};
const onZoomEnd = (evt: evt) => {
Expand All @@ -154,6 +162,7 @@ function SeeTogether() {

zoomTimerIdRef.current = setTimeout(() => {
setClusteredCoordinates();
adjustMapDirection();
}, 100);
};

Expand Down
9 changes: 9 additions & 0 deletions frontend/src/pages/SelectedTopic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ function SelectedTopic() {
setCoordinates((prev) => [...prev]);
};

const adjustMapDirection = () => {
if (!mapInstance) return;

mapInstance.setBearing(0);
mapInstance.setPitch(0);
};

useEffect(() => {
getAndSetDataFromServer();
setTags([]);
Expand All @@ -91,6 +98,7 @@ function SelectedTopic() {

dragTimerIdRef.current = setTimeout(() => {
setPrevCoordinates();
adjustMapDirection();
}, 100);
};
const onZoomEnd = (evt: evt) => {
Expand All @@ -100,6 +108,7 @@ function SelectedTopic() {

zoomTimerIdRef.current = setTimeout(() => {
setClusteredCoordinates();
adjustMapDirection();
}, 100);
};

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/types/tmap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading