From b5f702b74b8bea42eca3006aa36976ab0d4883ae Mon Sep 17 00:00:00 2001 From: changkyu choi Date: Wed, 15 Jan 2025 18:14:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EB=B6=95=EC=9E=AC=ED=95=A0=EB=8B=B9?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=ED=9B=84=20=EB=B0=B0=EC=B9=98=EB=A9=B4?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EC=84=A4=EC=A0=95=20=EC=A0=81=EC=9A=A9=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/placementShape/PlacementShapeSetting.jsx | 10 +++++----- src/hooks/roofcover/useRoofAllocationSetting.js | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index 9235ee8d..f2bb0103 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -59,11 +59,11 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return const raftCodeList = findCommonCode('203800') setRaftCodes(raftCodeList) - - if (addedRoofs.length > 0) { - setCurrentRoof({ ...currentRoof, roofSizeSet: addedRoofs[0].roofSizeSet, roofAngleSet: addedRoofs[0].roofAngleSet }) - } else if (basicSetting.roofSizeSet.length > 0) { - setCurrentRoof({ ...currentRoof, roofSizeSet: basicSetting.roofSizeSet, roofAngleSet: basicSetting.roofAngleSet }) + + if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) { + setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet }) + } else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) { + setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet }) } }, []) diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 3b956843..39487361 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -156,7 +156,13 @@ export function useRoofAllocationSetting(id) { } setCurrentRoofList(selectRoofs) - setBasicSetting({ ...basicSetting, roofsData: roofsArray }) + //setBasicSetting({ ...basicSetting, roofsData: roofsArray }) + setBasicSetting({ + ...basicSetting, + roofSizeSet: res[0].roofSizeSet, + roofAngleSet: res[0].roofAngleSet, + roofsData: roofsArray, + }) }) } catch (error) { console.error('Data fetching error:', error)