From c625101e7f3e50a455e27b083fe42e0b8a888f4f Mon Sep 17 00:00:00 2001 From: yschoi Date: Mon, 12 May 2025 19:03:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A7=B5=20=EC=A4=91=EB=B3=B5=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/Gis.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 224232c42..5cfff011d 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -27,7 +27,7 @@ function Gis({ treeData = [], isSearch = false }) { const [featureData,setFeatureData] = useState(null) // 선택된 피쳐 데이터 const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); // SearchModal 열림 상태 const gisCore = useMemo(() => new GisApp.core({ targetId: mapRef.current }), []); - //const [treeData, setTreeData] = useState([]); + const mapInstanceRef = useRef(null); // 맵 생성 여부를 추적할 ref const checkedLayerIds = useRef([]); let gisMap = null; const closePopup = () => { @@ -50,6 +50,7 @@ function Gis({ treeData = [], isSearch = false }) { useEffect(() => { if (!mapRef.current) return; + if (mapInstanceRef.current) return; // 이미 생성된 맵이 있다면 중단 // EPSG:5179 등록 proj4.defs([ @@ -60,7 +61,7 @@ function Gis({ treeData = [], isSearch = false }) { ]); register(proj4); - //맵 생성성 + //맵 생성 const map = new OlMap({ layers: [gisCore.baseLayers['base'], gisCore.baseLayers['satellite']], renderer: 'webgl', @@ -104,10 +105,10 @@ function Gis({ treeData = [], isSearch = false }) { gisCore.scaleControl(); gisCore.changeBaseLayer('base'); setMapObject({ map: map }); + mapInstanceRef.current = map; // 생성 완료 플래그 설정 }, []); useEffect(() => { - //if (!locgovCd) return null; if (!treeData || treeData.length === 0) return; gisCore.deleteAllOverlay(); @@ -146,7 +147,6 @@ function Gis({ treeData = [], isSearch = false }) { } } - return ( <>