From 124b4f9439a6158021d59506e5db9d6ec1cb2df7 Mon Sep 17 00:00:00 2001 From: KangShinGyu Date: Thu, 22 Oct 2026 15:26:28 +0900 Subject: [PATCH] =?UTF-8?q?fix(map):=20=EC=B5=9C=EC=86=8C=20=EB=B0=B0?= =?UTF-8?q?=EC=9C=A8=EC=97=90=EC=84=9C=20=ED=9C=A0=C2=B7=ED=8A=B8=EB=9E=99?= =?UTF-8?q?=ED=8C=A8=EB=93=9C=20=ED=99=95=EB=8C=80=EA=B0=80=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=97=90=20=EB=B0=98=EC=98=81=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/Map.tsx | 42 -------------------------------------- src/lib/maps.ts | 5 +++++ 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 0192a6e1..573a5165 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -185,47 +185,6 @@ function MapBootstrapSync({ return null; } -/** 가로 월드 래핑(지도 타일 무한 복제) 시 마지막 유효 중심으로 되돌림 */ -function MapPreventHorizontalWrap() { - const map = useMap(); - const lastValidCenterRef = useRef(null); - - useEffect(() => { - if (!map) return; - - const listener = map.addListener("center_changed", () => { - const bounds = map.getBounds(); - if (!bounds) return; - - const ne = bounds.getNorthEast(); - const sw = bounds.getSouthWest(); - if (ne.lng() > sw.lng()) { - const c = map.getCenter(); - if (c) { - lastValidCenterRef.current = { lat: c.lat(), lng: c.lng() }; - } - return; - } - - const last = lastValidCenterRef.current; - if (last) { - panToWithinWorld(map, last); - } - }); - - const c = map.getCenter(); - if (c) { - lastValidCenterRef.current = { lat: c.lat(), lng: c.lng() }; - } - - return () => { - google.maps.event.removeListener(listener); - }; - }, [map]); - - return null; -} - // ─── 방 destination 변경 시 지도 동기화(설정 수정 등)·캐시 갱신 ─────────────── function DestinationPanController({ @@ -590,7 +549,6 @@ export default function TripMap({ zoom={bootstrap.zoom} roomId={currentRoomId} /> - {!routeView && isMobileDevice ? : null} {/* 웹 일정에서 고른 장소로 이동 — 모바일(일반 지도·경로 보기)은 쓰지 않는다 */} diff --git a/src/lib/maps.ts b/src/lib/maps.ts index 5c70a3de..9a714ad7 100644 --- a/src/lib/maps.ts +++ b/src/lib/maps.ts @@ -143,6 +143,11 @@ export const MAP_WORLD_LAT_LNG_BOUNDS: google.maps.LatLngBoundsLiteral = { east: 179.999, }; +/** + * 가로 래핑도 이 restriction만으로 막는다. `center_changed`에서 bounds를 보고 되돌리지 않는다 — + * 휠·트랙패드 확대는 `setCenter` 뒤에 `setZoom`이 와서 그 사이 bounds(새 중심·이전 줌)가 날짜변경선을 넘은 것처럼 보이고, + * 이때 되돌리면 확대가 끊겨 줌 값만 바뀌고 화면은 멈춘다. + */ export const MAP_PAN_RESTRICTION: google.maps.MapRestriction = { latLngBounds: MAP_WORLD_LAT_LNG_BOUNDS, strictBounds: true,