From e186ca17748b36572ad78379c58d6c1c290100c9 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Fri, 18 Oct 2024 14:57:25 +0900 Subject: [PATCH] =?UTF-8?q?object=20=EB=B0=B0=EC=B9=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/modal/object/ObjectSetting.jsx | 11 +++--- src/hooks/object/useObjectBatch.js | 34 ++++++++++++------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/components/floor-plan/modal/object/ObjectSetting.jsx b/src/components/floor-plan/modal/object/ObjectSetting.jsx index 764535e3..cb1b0b45 100644 --- a/src/components/floor-plan/modal/object/ObjectSetting.jsx +++ b/src/components/floor-plan/modal/object/ObjectSetting.jsx @@ -51,15 +51,12 @@ export default function ObjectSetting({ setShowObjectSettingModal }) { } const applyObject = () => { - // if (surfaceShapePolygons.length === 0) { - // swalFire({ text: '지붕이 없어요 지붕부터 그리세요', icon: 'error' }) - // return - // } + if (surfaceShapePolygons.length === 0) { + swalFire({ text: '지붕이 없어요 지붕부터 그리세요', icon: 'error' }) + return + } //개구배치, 그림자배치 - - console.log(surfaceShapePolygons) - if (buttonAct === 1 || buttonAct === 2) { applyOpeningAndShadow(objectPlacement, buttonAct, surfaceShapePolygons) } else { diff --git a/src/hooks/object/useObjectBatch.js b/src/hooks/object/useObjectBatch.js index 600dece7..e18b13e3 100644 --- a/src/hooks/object/useObjectBatch.js +++ b/src/hooks/object/useObjectBatch.js @@ -200,20 +200,34 @@ export function useObjectBatch() { } } + /** + * 오브젝트 도머 배치 + * @param {} dormerPlacement + * @param {*} buttonAct + * @param {*} surfaceShapePolygons + * @returns + */ const applyDormers = (dormerPlacement, buttonAct, surfaceShapePolygons) => { const dormerName = buttonAct === 3 ? BATCH_TYPE.TRIANGLE_DORMER : BATCH_TYPE.PENTAGON_DORMER const dormerTempName = buttonAct === 3 ? BATCH_TYPE.TRIANGLE_DORMER_TEMP : BATCH_TYPE.PENTAGON_DORMER_TEMP - const height = dormerPlacement.heightRef.current.value / 10 - const width = dormerPlacement.widthRef.current.value / 10 - const pitch = dormerPlacement.pitchRef.current.value - const offsetRef = dormerPlacement.offsetRef.current.value === '' ? 0 : parseInt(dormerPlacement.offsetRef.current.value) / 10 - const offsetWidthRef = dormerPlacement.offsetWidthRef.current.value === '' ? 0 : parseInt(dormerPlacement.offsetWidthRef.current.value) / 10 + const height = dormerPlacement.heightRef.current !== null ? dormerPlacement.heightRef.current.value / 10 : 0 + const width = dormerPlacement.widthRef.current !== null ? dormerPlacement.widthRef.current.value / 10 : 0 //triangle일때는 없음 + const pitch = dormerPlacement.pitchRef.current !== null ? dormerPlacement.pitchRef.current.value : 0 + const offsetRef = + dormerPlacement.offsetRef.current !== null + ? dormerPlacement.offsetRef.current.value === '' + ? 0 + : parseInt(dormerPlacement.offsetRef.current.value) / 10 + : 0 + const offsetWidthRef = + dormerPlacement.offsetWidthRef.current !== null + ? dormerPlacement.offsetWidthRef.current.value === '' + ? 0 + : parseInt(dormerPlacement.offsetWidthRef.current.value) / 10 + : 0 const directionRef = dormerPlacement.directionRef.current - let dormer, dormerOffset, isDown, selectedSurface, pentagonPoints, pentagonOffsetPoints - console.log('dormerPlacement', dormerPlacement) - if (height === '' || pitch === '' || height <= 0 || pitch <= 0) { swalFire({ text: getMessage('common.canvas.validate.size'), icon: 'error' }) return @@ -636,8 +650,6 @@ export function useObjectBatch() { const splitDormerPentagon = (pentagon, direction, offsetMode) => { const points = pentagon.points - console.log(pentagon.points) - let leftPoints = [] let rightPoints = [] @@ -699,8 +711,6 @@ export function useObjectBatch() { ] } - console.log(leftPoints, rightPoints) - return [leftPoints, rightPoints] }