diff --git a/src/components/floor-plan/modal/basic/step/Placement.jsx b/src/components/floor-plan/modal/basic/step/Placement.jsx index 4eeeab0a..e8d8048f 100644 --- a/src/components/floor-plan/modal/basic/step/Placement.jsx +++ b/src/components/floor-plan/modal/basic/step/Placement.jsx @@ -21,6 +21,8 @@ const Placement = forwardRef((props, refs) => { const moduleSelectionData = useRecoilValue(moduleSelectionDataState) const { makeModuleInitArea } = useModuleBasicSetting(3) + const [isMultiModule, setIsMultiModule] = useState(false) + //모듈 배치면 생성 useEffect(() => { if (moduleSelectionData) { @@ -49,6 +51,11 @@ const Placement = forwardRef((props, refs) => { setSelectedItems(initCheckedModule) setSelectedModules(moduleSelectionData.module) } + + //모듈 배치면 생성 + if (moduleSelectionData.module.itemList.length > 1) { + setIsMultiModule(true) + } } }, [moduleSelectionData]) @@ -190,6 +197,7 @@ const Placement = forwardRef((props, refs) => { checked={setupLocation === 'center'} value={'center'} onChange={handleSetupLocation} + disabled={isMultiModule} /> @@ -212,6 +220,7 @@ const Placement = forwardRef((props, refs) => { checked={setupLocation === 'ridge'} value={'ridge'} onChange={handleSetupLocation} + disabled={isMultiModule} /> diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index a9289861..61198ad4 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -2076,7 +2076,7 @@ export const useTrestle = () => { mixMatlNo: module.mixMatlNo, raftBaseCd: addRoof.raft, inclCd: addRoof.pitch, - roofPitch: addRoof.roofPchBase, + roofPitch: !addRoof.roofPchBase ? addRoof.roofPchBase : Number(addRoof.roofPchBase), exposedLowerBottomTotCnt: result.exposedBottom, // 노출 최하면 갯수 exposedHalfBottomTotCnt: result.exposedHalfBottom, // 노출 반하면 갯수 exposedTopTotCnt: result.exposedTop, // 노출 상면 총 수 @@ -2443,25 +2443,25 @@ export const useTrestle = () => { (centerPoint) => Math.abs(centerPoint.x - halfTopRightPoint.x) < maxX && Math.abs(centerPoint.y - halfTopRightPoint.y) < maxY, ) } - if (leftModule) { + if (!leftModule) { leftPoint = { x: x - width, y: y } leftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - leftPoint.x) < maxX && Math.abs(centerPoint.y - leftPoint.y) < maxY, ) } - if (rightModule) { + if (!rightModule) { rightPoint = { x: x + width, y: y } rightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - rightPoint.x) < maxX && Math.abs(centerPoint.y - rightPoint.y) < maxY, ) } - if (bottomLeftModule) { + if (!bottomLeftModule) { bottomLeftPoint = { x: x - width, y: y + h } bottomLeftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < maxX && Math.abs(centerPoint.y - bottomLeftPoint.y) < maxY, ) } - if (bottomRightModule) { + if (!bottomRightModule) { bottomRightPoint = { x: x + width, y: y + h } bottomRightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < maxX && Math.abs(centerPoint.y - bottomRightPoint.y) < maxY, @@ -2504,25 +2504,25 @@ export const useTrestle = () => { (centerPoint) => Math.abs(centerPoint.x - halfTopRightPoint.x) < maxX && Math.abs(centerPoint.y - halfTopRightPoint.y) < maxY, ) } - if (leftModule) { + if (!leftModule) { leftPoint = { x: x + width, y: y } leftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - leftPoint.x) < maxX && Math.abs(centerPoint.y - leftPoint.y) < maxY, ) } - if (rightModule) { + if (!rightModule) { rightPoint = { x: x - width, y: y } rightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - rightPoint.x) < maxX && Math.abs(centerPoint.y - rightPoint.y) < maxY, ) } - if (bottomLeftModule) { + if (!bottomLeftModule) { bottomLeftPoint = { x: x + width, y: y - h } bottomLeftModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < maxX && Math.abs(centerPoint.y - bottomLeftPoint.y) < maxY, ) } - if (bottomRightModule) { + if (!bottomRightModule) { bottomRightPoint = { x: x - width, y: y - h } bottomRightModule = centerPoints.find( (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < maxX && Math.abs(centerPoint.y - bottomRightPoint.y) < maxY, diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index 7d9bc925..440a6319 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -333,7 +333,7 @@ export function usePlan(params = {}) { */ const handleAddPlan = async (userId, objectNo) => { if (currentCanvasPlan?.id) { - await saveCanvas(true) + await saveCanvas(false) } JSON.parse(currentCanvasData()).objects.length > 0 ? swalFire({