아이콘 진행방향에 따른 회전 재구현
This commit is contained in:
@@ -498,7 +498,10 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
|
||||
// 위도/경도가 있고 polygon 모드가 아니면 마커로 처리
|
||||
if (lat !== undefined && lng !== undefined && (mapDisplayType as string) !== "polygon") {
|
||||
markers.push({
|
||||
id: `${sourceName}-marker-${index}-${row.code || row.id || Date.now()}`, // 고유 ID 생성
|
||||
// 진행 방향(heading) 계산을 위해 ID는 새로고침마다 바뀌지 않도록 고정값 사용
|
||||
// - row.id / row.code가 있으면 그 값을 사용
|
||||
// - 없으면 sourceName과 index 조합으로 고정 ID 생성
|
||||
id: row.id || row.code || `${sourceName}-marker-${index}`,
|
||||
lat: Number(lat),
|
||||
lng: Number(lng),
|
||||
latitude: Number(lat),
|
||||
@@ -987,7 +990,7 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
|
||||
markers.reduce((sum, m) => sum + m.lat, 0) / markers.length,
|
||||
markers.reduce((sum, m) => sum + m.lng, 0) / markers.length,
|
||||
]
|
||||
: [20, 0]; // 🌍 세계 지도 중심 (ISS 테스트용)
|
||||
: [36.5, 127.5]; // 한국 중심
|
||||
|
||||
return (
|
||||
<div className="bg-background flex h-full w-full flex-col">
|
||||
@@ -1027,17 +1030,22 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
|
||||
<MapContainer
|
||||
key={`map-widget-${element.id}`}
|
||||
center={center}
|
||||
zoom={element.chartConfig?.initialZoom || 8}
|
||||
minZoom={8}
|
||||
maxZoom={18}
|
||||
scrollWheelZoom={true}
|
||||
doubleClickZoom={true}
|
||||
touchZoom={true}
|
||||
zoomControl={true}
|
||||
zoom={element.chartConfig?.initialZoom ?? 8}
|
||||
minZoom={element.chartConfig?.minZoom ?? 8}
|
||||
maxZoom={element.chartConfig?.maxZoom ?? 18}
|
||||
scrollWheelZoom
|
||||
doubleClickZoom
|
||||
touchZoom
|
||||
zoomControl
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
className="z-0"
|
||||
>
|
||||
<TileLayer url={tileMapUrl} attribution="© VWorld" minZoom={8} maxZoom={18} />
|
||||
<TileLayer
|
||||
url={tileMapUrl}
|
||||
attribution="© VWorld"
|
||||
minZoom={element.chartConfig?.minZoom ?? 8}
|
||||
maxZoom={element.chartConfig?.maxZoom ?? 18}
|
||||
/>
|
||||
|
||||
{/* 폴리곤 렌더링 */}
|
||||
{/* GeoJSON 렌더링 (육지 지역 경계선) */}
|
||||
|
||||
Reference in New Issue
Block a user