import { useRef, useState } from 'react'; import { MapView } from '@common/components/map/MapView'; import type { OilReportPayload } from '@common/hooks/useSubMenu'; interface OilSpreadMapPanelProps { mapData: OilReportPayload['mapData']; capturedImage: string | null; onCapture: (dataUrl: string) => void; onReset: () => void; } const OilSpreadMapPanel = ({ mapData, capturedImage, onCapture, onReset }: OilSpreadMapPanelProps) => { const captureRef = useRef<(() => Promise) | null>(null); const [isCapturing, setIsCapturing] = useState(false); const handleCapture = async () => { if (!captureRef.current) return; setIsCapturing(true); const dataUrl = await captureRef.current(); setIsCapturing(false); if (dataUrl) { onCapture(dataUrl); } }; if (!mapData) { return (
확산 예측 데이터가 없습니다. 예측 탭에서 시뮬레이션을 실행 후 보고서를 생성하세요.
); } return (
{/* 지도 + 오버레이 컨테이너 — MapView 항상 마운트 유지 (deck.gl rAF race condition 방지) */}
{/* 캡처 이미지 오버레이 — 우측 상단 */} {capturedImage && (
확산예측 지도 캡처
📷 캡처 완료
)}
{/* 하단 안내 + 캡처 버튼 */}

{capturedImage ? 'PDF 다운로드 시 캡처된 이미지가 포함됩니다.' : '지도를 이동/확대하여 원하는 범위를 선택한 후 캡처하세요.'}

); }; export default OilSpreadMapPanel;