fix(map): 클러스터 expansion 후 마커 클릭 시 재묶임 방지
- selected 시 무조건 zoom 16 → 줌 18에서 마커 클릭하면 다시 16으로 줄어 클러스터링 - 현재 zoom ≥ 16이면 유지, 미만이면 16으로 (Naver/Google 둘 다) - page.tsx의 setRegionFlyTo 호출 제거 — selected useEffect로 일원화 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -241,12 +241,15 @@ export default function NaverMapView({
|
||||
else m.panTo(latlng);
|
||||
}, [flyTo]);
|
||||
|
||||
// selected 변경 시 자동 중앙 + zoom
|
||||
// selected 변경 시 자동 중앙 — 현재 줌이 16 이상이면 그대로, 미만이면 16으로 확대
|
||||
// (클러스터 expansion으로 18까지 들어간 상태에서 마커 클릭 시 다시 16으로 줄어 클러스터링되는 것 방지)
|
||||
useEffect(() => {
|
||||
const m = mapRef.current;
|
||||
if (!m || !selected || !window.naver?.maps) return;
|
||||
if (selected.latitude == null || selected.longitude == null) return;
|
||||
m.morph(new window.naver.maps.LatLng(selected.latitude, selected.longitude), 16);
|
||||
const latlng = new window.naver.maps.LatLng(selected.latitude, selected.longitude);
|
||||
const targetZoom = Math.max(m.getZoom(), 16);
|
||||
m.morph(latlng, targetZoom);
|
||||
}, [selected]);
|
||||
|
||||
// 클러스터 계산 (bounds/zoom 변경 시)
|
||||
|
||||
Reference in New Issue
Block a user