diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 0192a6e..573a516 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 5c70a3d..9a714ad 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,