diff --git a/src/components/floor-plan/modal/roofShape/RoofShapeSetting.jsx b/src/components/floor-plan/modal/roofShape/RoofShapeSetting.jsx index e60aadc6..b43bdd18 100644 --- a/src/components/floor-plan/modal/roofShape/RoofShapeSetting.jsx +++ b/src/components/floor-plan/modal/roofShape/RoofShapeSetting.jsx @@ -39,6 +39,8 @@ export default function RoofShapeSetting({ id, pos = { x: 50, y: 230 } }) { handleConfirm, handleRollBack, pitchText, + shedPitch, + setShedPitch, } = useRoofShapeSetting(id) const { closePopup } = usePopup() @@ -61,6 +63,8 @@ export default function RoofShapeSetting({ id, pos = { x: 50, y: 230 } }) { setHipAndGableWidth, shedWidth, setShedWidth, + shedPitch, + setShedPitch, hasSleeve, setHasSleeve, buttonAct, diff --git a/src/components/floor-plan/modal/roofShape/type/Side.jsx b/src/components/floor-plan/modal/roofShape/type/Side.jsx index 487ccd43..26a4957f 100644 --- a/src/components/floor-plan/modal/roofShape/type/Side.jsx +++ b/src/components/floor-plan/modal/roofShape/type/Side.jsx @@ -33,6 +33,8 @@ export default function Side(props) { handleConfirm, handleRollBack, pitchText, + shedPitch, + setShedPitch, } = props const eavesProps = { pitch, setPitch, eavesOffset, setEavesOffset, pitchText } @@ -40,7 +42,7 @@ export default function Side(props) { const wallProps = { sleeveOffset, setSleeveOffset, hasSleeve, setHasSleeve } const hipAndGableProps = { pitch, setPitch, eavesOffset, setEavesOffset, hipAndGableWidth, setHipAndGableWidth, pitchText } const jerkinheadProps = { gableOffset, setGableOffset, jerkinHeadWidth, setJerkinHeadWidth, jerkinHeadPitch, setJerkinHeadPitch, pitchText } - const shedProps = { shedWidth, setShedWidth } + const shedProps = { shedWidth, setShedWidth, shedPitch, setShedPitch, pitchText } const { getMessage } = useMessage() diff --git a/src/components/floor-plan/modal/roofShape/type/option/Shed.jsx b/src/components/floor-plan/modal/roofShape/type/option/Shed.jsx index 40ccdbef..5ad53f7b 100644 --- a/src/components/floor-plan/modal/roofShape/type/option/Shed.jsx +++ b/src/components/floor-plan/modal/roofShape/type/option/Shed.jsx @@ -1,10 +1,19 @@ import { useMessage } from '@/hooks/useMessage' -import { onlyNumberInputChange } from '@/util/input-utils' +import { onlyNumberInputChange, onlyNumberWithDotInputChange } from '@/util/input-utils' -export default function Shed({ shedWidth, setShedWidth }) { +export default function Shed({ shedWidth, setShedWidth, shedPitch, setShedPitch, pitchText }) { const { getMessage } = useMessage() return ( <> +
+ + {getMessage('slope')} + +
+ onlyNumberWithDotInputChange(e, setShedPitch)} /> +
+ {pitchText} +
{getMessage('shed.width')}
diff --git a/src/hooks/common/useCommonUtils.js b/src/hooks/common/useCommonUtils.js index ca9b8def..84c4fdb0 100644 --- a/src/hooks/common/useCommonUtils.js +++ b/src/hooks/common/useCommonUtils.js @@ -476,7 +476,7 @@ export function useCommonUtils() { addDocumentEventListener('keydown', document, (e) => { if (e.key === 'Enter') { const activeObject = canvas.getActiveObject() - if (activeObject.name === 'commonText') { + if (activeObject && activeObject.name === 'commonText') { if (activeObject && activeObject.isEditing) { if (activeObject.text === '') { canvas?.remove(activeObject) @@ -756,7 +756,6 @@ export function useCommonUtils() { return { commonFunctions, dimensionSettings, - commonDeleteText, commonMoveObject, commonDeleteText, deleteObject, diff --git a/src/hooks/roofcover/useRoofShapeSetting.js b/src/hooks/roofcover/useRoofShapeSetting.js index e0d850f4..ae886ce9 100644 --- a/src/hooks/roofcover/useRoofShapeSetting.js +++ b/src/hooks/roofcover/useRoofShapeSetting.js @@ -29,6 +29,7 @@ export function useRoofShapeSetting(id) { const [jerkinHeadWidth, setJerkinHeadWidth] = useState(800) // 반절처 폭 const [jerkinHeadPitch, setJerkinHeadPitch] = useState(currentAngleType === ANGLE_TYPE.SLOPE ? 4.5 : 20) // 반절처 경사 const [hipAndGableWidth, setHipAndGableWidth] = useState(800) // 팔작지붕 폭 + const [shedPitch, setShedPitch] = useState(currentAngleType === ANGLE_TYPE.SLOPE ? 4 : 21.8) // 팔작지붕 폭 const [shedWidth, setShedWidth] = useState(300) // 한쪽흐름 폭 const [hasSleeve, setHasSleeve] = useState('0') const currentObject = useRecoilValue(currentObjectState) @@ -41,6 +42,7 @@ export function useRoofShapeSetting(id) { const isFixRef = useRef(false) const pitchRef = useRef(null) + const shedPitchRef = useRef(null) const jerkinHeadPitchRef = useRef(null) const history = useRef([]) @@ -49,6 +51,9 @@ export function useRoofShapeSetting(id) { useEffect(() => { pitchRef.current = currentAngleType === ANGLE_TYPE.SLOPE ? pitch : getChonByDegree(pitch) }, [pitch]) + useEffect(() => { + shedPitchRef.current = currentAngleType === ANGLE_TYPE.SLOPE ? shedPitch : getChonByDegree(shedPitch) + }, [shedPitch]) useEffect(() => { jerkinHeadPitchRef.current = currentAngleType === ANGLE_TYPE.SLOPE ? jerkinHeadPitch : getChonByDegree(jerkinHeadPitch) }, [jerkinHeadPitch]) @@ -579,8 +584,12 @@ export function useRoofShapeSetting(id) { // 한쪽흐름 attributes = { type: LINE_TYPE.WALLLINE.SHED, + pitch: shedPitchRef.current, width: shedWidth / 10, } + addPitchText(currentObject) + selectedLine.set({ strokeWidth: 4 }) + selectedLine.set({ stroke: '#000000' }) break } } @@ -648,5 +657,7 @@ export function useRoofShapeSetting(id) { handleConfirm, handleRollBack, pitchText, + shedPitch, + setShedPitch, } } diff --git a/src/hooks/useAdsorptionPoint.js b/src/hooks/useAdsorptionPoint.js index 396db98c..4bdef964 100644 --- a/src/hooks/useAdsorptionPoint.js +++ b/src/hooks/useAdsorptionPoint.js @@ -31,9 +31,8 @@ export function useAdsorptionPoint() { name: 'adsorptionPoint', visible: isGridDisplay, }) - canvas.add(adsorptionPoint) - + setAdsorptionPointMode(true) canvas.renderAll() } diff --git a/src/hooks/useCanvasEvent.js b/src/hooks/useCanvasEvent.js index ab283a08..9573936a 100644 --- a/src/hooks/useCanvasEvent.js +++ b/src/hooks/useCanvasEvent.js @@ -119,7 +119,8 @@ export function useCanvasEvent() { target.fill = lengthTextOption.fontColor.value target.fontFamily = lengthTextOption.fontFamily.value target.fontSize = lengthTextOption.fontSize.value - target.fontWeight = lengthTextOption.fontWeight.value + target.fontStyle = lengthTextOption.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal' + target.fontWeight = lengthTextOption.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal' // Add a property to store the previous value const previousValue = target.text