From 7524fc19e3776bb08ce4fa1c4dc04b9978777f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Thu, 26 Oct 2023 16:43:07 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EB=B9=84=ED=96=89=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=EB=B9=84=EC=A0=95=EC=83=81=EC=83=81=ED=99=A9=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/mapbox/draw/LaancDrawControl.js | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/src/components/map/mapbox/draw/LaancDrawControl.js b/src/components/map/mapbox/draw/LaancDrawControl.js index c13f1d3..0df5082 100644 --- a/src/components/map/mapbox/draw/LaancDrawControl.js +++ b/src/components/map/mapbox/draw/LaancDrawControl.js @@ -157,24 +157,36 @@ export const LaancDrawControl = props => { drawObj.setFeatureProperty(newBufferId[0], 'lineId', obj.id); setBufferId(newBufferId[0]); - if (length < 1) { - setAlertModal({ - isOpen: true, + if (length < 2) { + // setAlertModal({ + // isOpen: true, + // title: '좌표 최소 개수', + // desc: '좌표를 두 개 점으로 이어주세요.' + // }); + props.setModal({ title: '좌표 최소 개수', - desc: '좌표를 두 개 점으로 이어주세요.' + desc: <>좌표를 두 개 점으로 이어주세요., + isOpen: true }); handlerRemoveError(obj.id); + return; } } else if (mode === 'POLYGON') { obj.coordinates[0].splice(-1); - if (length < 2) { - setAlertModal({ - isOpen: true, + if (length < 3) { + // setAlertModal({ + // isOpen: true, + // title: '좌표 최소 개수', + // desc: '좌표를 세 개 점으로 이어주세요.' + // }); + props.setModal({ title: '좌표 최소 개수', - desc: '좌표를 세 개 점으로 이어주세요.' + desc: <>좌표를 세 개 점으로 이어주세요., + isOpen: true }); handlerRemoveError(obj.id); + return; } } const data = { @@ -282,20 +294,7 @@ export const LaancDrawControl = props => { alert('에러 발생'); } - props.handlerCoordinates(areaInfo); - setIsDrawDone(true); - - const viewCoordObj = drawObj - .getAll() - .features.filter(o => o.properties.id !== 'BUFFER'); - - props.setViewCoordObj(viewCoordObj); - - if (viewCoordObj.length > 19) { - props.handlerAddChange('overAdd', true); - } else { - props.handlerAddChange('isViewAdd', true); - } + handlerSaveData(areaInfo); }; // 비가시권 검사 @@ -417,6 +416,25 @@ export const LaancDrawControl = props => { props.setViewCoordObj(viewCoordObj); }; + // 정상 좌표 처리 + const handlerSaveData = areaInfo => { + console.log('ok!!!'); + props.handlerCoordinates(areaInfo); + setIsDrawDone(true); + + const viewCoordObj = drawObj + .getAll() + .features.filter(o => o.properties.id !== 'BUFFER'); + + props.setViewCoordObj(viewCoordObj); + + if (viewCoordObj.length > 19) { + props.handlerAddChange('overAdd', true); + } else { + props.handlerAddChange('isViewAdd', true); + } + }; + // areaInfo 셋팅 const handlerSettingAreaInfo = data => { if (!data.coord || !data.mode) {