diff --git a/src/components/floor-plan/modal/Slope.jsx b/src/components/floor-plan/modal/Slope.jsx index 0ae32ab6..ba9ede2a 100644 --- a/src/components/floor-plan/modal/Slope.jsx +++ b/src/components/floor-plan/modal/Slope.jsx @@ -1,8 +1,13 @@ import { useMessage } from '@/hooks/useMessage' import WithDraggable from '@/components/common/draggable/WithDraggable' +import { globalPitchState } from '@/store/canvasAtom' +import { useRecoilState } from 'recoil' +import { useRef } from 'react' export default function Slope({ setShowSlopeSettingModal }) { const { getMessage } = useMessage() + const [globalPitch, setGlobalPitch] = useRecoilState(globalPitchState) + const inputRef = useRef() return (
@@ -19,13 +24,21 @@ export default function Slope({ setShowSlopeSettingModal }) { {getMessage('slope')}
- +
{getMessage('size.angle')}
- +
diff --git a/src/hooks/roofcover/useAuxiliaryDrawing.js b/src/hooks/roofcover/useAuxiliaryDrawing.js index f479a92e..e5e79740 100644 --- a/src/hooks/roofcover/useAuxiliaryDrawing.js +++ b/src/hooks/roofcover/useAuxiliaryDrawing.js @@ -607,10 +607,15 @@ export function useAuxiliaryDrawing(setShowAuxiliaryModal) { * 일변전으로 돌아가기 */ const handleRollback = () => { - const lastLine = lineHistory.current.pop() - mousePointerArr.current = [] - canvas.remove(...canvas.getObjects().filter((obj) => obj.name === 'innerPoint')) + const innerPoint = canvas.getObjects().find((obj) => obj.name === 'innerPoint') + if (innerPoint) { + mousePointerArr.current = [] + canvas.remove(innerPoint) + canvas.renderAll() + return + } + const lastLine = lineHistory.current.pop() if (lastLine) { roofAdsorptionPoints.current = roofAdsorptionPoints.current.filter( (point) => point.x !== lastLine.intersectionPoint?.x && point.y !== lastLine.intersectionPoint?.y, @@ -640,6 +645,7 @@ export function useAuxiliaryDrawing(setShowAuxiliaryModal) { const inPolygon2 = booleanPointInPolygon([line.x2, line.y2], turfPolygon) if (inPolygon1 && inPolygon2) { + line.attributes = { ...line.attributes, roofId: roofBase.id } return true } }) diff --git a/src/hooks/roofcover/useOuterLineWall.js b/src/hooks/roofcover/useOuterLineWall.js index 00405a3b..85c37015 100644 --- a/src/hooks/roofcover/useOuterLineWall.js +++ b/src/hooks/roofcover/useOuterLineWall.js @@ -34,8 +34,14 @@ import { QLine } from '@/components/fabric/QLine' //외벽선 그리기 export function useOuterLineWall(setShowOutlineModal) { const canvas = useRecoilValue(canvasState) - const { addCanvasMouseEventListener, addDocumentEventListener, removeAllMouseEventListeners, removeAllDocumentEventListeners, removeMouseEvent } = - useEvent() + const { + initEvent, + addCanvasMouseEventListener, + addDocumentEventListener, + removeAllMouseEventListeners, + removeAllDocumentEventListeners, + removeMouseEvent, + } = useEvent() const { getIntersectMousePoint } = useMouse() const { addLine, removeLine } = useLine() const { tempGridMode } = useTempGrid() @@ -76,6 +82,9 @@ export function useOuterLineWall(setShowOutlineModal) { addCanvasMouseEventListener('mouse:down', mouseDown) clear() + return () => { + initEvent() + } }, [verticalHorizontalMode, points, adsorptionPointAddMode, adsorptionPointMode, adsorptionRange, interval, tempGridMode]) useEffect(() => { diff --git a/src/hooks/roofcover/useRoofShapePassivitySetting.js b/src/hooks/roofcover/useRoofShapePassivitySetting.js index bedbcd11..f7b8b9fd 100644 --- a/src/hooks/roofcover/useRoofShapePassivitySetting.js +++ b/src/hooks/roofcover/useRoofShapePassivitySetting.js @@ -209,10 +209,12 @@ export function useRoofShapePassivitySetting(setShowRoofShapePassivitySettingMod wall.lines = [...lines] // 기존 그려진 지붕이 없다면 - if (roofBases.length === 0) { - return + + if (isFix.current) { + // 완료 한 경우에는 지붕까지 그려줌 + const roof = drawRoofPolygon(wall) } - const roof = drawRoofPolygon(wall) + canvas.renderAll() } diff --git a/src/store/canvasAtom.js b/src/store/canvasAtom.js index 7806b8f2..f3a81661 100644 --- a/src/store/canvasAtom.js +++ b/src/store/canvasAtom.js @@ -289,3 +289,8 @@ export const canGridOptionSeletor = selector({ return points.length === 0 || outerLineFix }, }) + +export const globalPitchState = atom({ + key: 'globalPitch', + default: 4, +})