서까래 수정

This commit is contained in:
yjnoh 2025-02-09 15:20:13 +09:00
parent 393cfd5277
commit e54042be49
3 changed files with 66 additions and 45 deletions

View File

@ -17,6 +17,13 @@ const PitchPlacement = forwardRef((props, refs) => {
const setCheckedModules = useSetRecoilState(checkedModuleState) const setCheckedModules = useSetRecoilState(checkedModuleState)
const moduleSelectionData = useRecoilValue(moduleSelectionDataState) // const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //
const [selectedItems, setSelectedItems] = useState({}) const [selectedItems, setSelectedItems] = useState({})
const { makeModuleInitArea } = useModuleBasicSetting(3)
useEffect(() => {
if (moduleSelectionData) {
makeModuleInitArea(moduleSelectionData)
}
}, [])
useEffect(() => { useEffect(() => {
handleChangeSetupLocation() handleChangeSetupLocation()

View File

@ -865,9 +865,9 @@ export function useModuleBasicSetting(tabNum) {
} }
} }
//밑에가 평면이면 좌측으로 붙여서 배치 //밑에가 평면이면 좌측으로 붙여서 배치
if (flowLines.bottom.type === 'flat' && flowLines.left.type === 'curve') { // if (flowLines.bottom.type === 'flat' && flowLines.left.type === 'curve') {
startPoint = flowLines.left // startPoint = flowLines.left
} // }
const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측 const maxLeftEndPoint = surfaceMaxLines.left.x1 //최 좌측
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측 const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
@ -930,9 +930,9 @@ export function useModuleBasicSetting(tabNum) {
} }
} else { } else {
//디버깅용 //디버깅용
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 }) // tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule) // canvas?.add(tempModule)
canvas.renderAll() // canvas.renderAll()
} }
} }
} }
@ -960,14 +960,14 @@ export function useModuleBasicSetting(tabNum) {
let startPoint = flowLines.left let startPoint = flowLines.left
const moduleArray = [] const moduleArray = []
if (flowLines.left.type === 'flat') { // if (flowLines.left.type === 'flat') {
const tempPoint = { ...flowLines.top } // const tempPoint = { ...flowLines.top }
startPoint = { ...flowLines.top, x1: tempPoint.x2, x2: tempPoint.x1 } // startPoint = { ...flowLines.top, x1: tempPoint.x2, x2: tempPoint.x1 }
} else { // } else {
flowLines = getFlowLines(moduleSetupSurface, height) // flowLines = getFlowLines(moduleSetupSurface, height)
const tempPoint = { ...flowLines.left } // const tempPoint = { ...flowLines.left }
startPoint = { ...flowLines.left, x1: tempPoint.x1 + 5, x2: tempPoint.x2, y1: tempPoint.y1 - 5 } // startPoint = { ...flowLines.left, x1: tempPoint.x1 + 5, x2: tempPoint.x2, y1: tempPoint.y1 - 5 }
} // }
//중앙배치일 경우에는 계산한다 //중앙배치일 경우에는 계산한다
if (isCenter) { if (isCenter) {
@ -1046,9 +1046,9 @@ export function useModuleBasicSetting(tabNum) {
} }
} else { } else {
//디버깅용 //디버깅용
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 }) // tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule) // canvas?.add(tempModule)
canvas.renderAll() // canvas.renderAll()
} }
} }
} }
@ -1073,9 +1073,9 @@ export function useModuleBasicSetting(tabNum) {
const flowLines = getFlowLines(moduleSetupSurface, height) const flowLines = getFlowLines(moduleSetupSurface, height)
let startPoint = flowLines.top let startPoint = flowLines.top
if (flowLines.top.type === 'flat' && flowLines.right.type === 'curve') { // if (flowLines.top.type === 'flat' && flowLines.right.type === 'curve') {
startPoint = flowLines.right // startPoint = flowLines.right
} // }
const moduleArray = [] const moduleArray = []
@ -1170,9 +1170,9 @@ export function useModuleBasicSetting(tabNum) {
} }
} else { } else {
//디버깅용 //디버깅용
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 }) // tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule) // canvas?.add(tempModule)
canvas.renderAll() // canvas.renderAll()
} }
} }
} }
@ -1197,16 +1197,16 @@ export function useModuleBasicSetting(tabNum) {
let flowLines = getFlowLines(moduleSetupSurface, width) let flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.right let startPoint = flowLines.right
if (flowLines.right.type === 'flat') { // if (flowLines.right.type === 'flat') {
const tempPoint = { ...flowLines.bottom } // const tempPoint = { ...flowLines.bottom }
startPoint = { ...flowLines.bottom, x1: tempPoint.x2, x2: tempPoint.x1 } // startPoint = { ...flowLines.bottom, x1: tempPoint.x2, x2: tempPoint.x1 }
} else { // } else {
flowLines = getFlowLines(moduleSetupSurface, height) // flowLines = getFlowLines(moduleSetupSurface, height)
const tempPoint = { ...flowLines.right } // const tempPoint = { ...flowLines.right }
startPoint = { ...flowLines.right, x1: tempPoint.x1 - 5, x2: tempPoint.x2, y1: tempPoint.y1 + 5 } // startPoint = { ...flowLines.right, x1: tempPoint.x1 - 5, x2: tempPoint.x2, y1: tempPoint.y1 + 5 }
} // }
console.log('startPoint', startPoint) // console.log('startPoint', startPoint)
const moduleArray = [] const moduleArray = []
@ -1290,9 +1290,9 @@ export function useModuleBasicSetting(tabNum) {
} }
} else { } else {
//디버깅용 //디버깅용
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 }) // tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule) // canvas?.add(tempModule)
canvas.renderAll() // canvas.renderAll()
} }
} }
} }

View File

@ -57,12 +57,12 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
//서까래간격 변경 //서까래간격 변경
const handleChangeRaftBase = (option) => { const handleChangeRaftBase = (option) => {
setSelectedRaftBase(option) setSelectedRaftBase({ raftBaseCd: option.clCode, clCode: option.clCode })
resetSelected(1)
setTrestleParams({ ...trestleParams, raftBaseCd: option.clCode }) //가대메이커 setTrestleParams({ ...trestleParams, raftBaseCd: option.clCode }) //가대메이커
// setConstMthdList([]) //공법 초기화 // setConstMthdList([]) //공법 초기화
// setRoofBaseList([]) //지붕밑바탕 초기화 // setRoofBaseList([]) //지붕밑바탕 초기화
// setConstructionList([]) //공법 초기화 // setConstructionList([]) //공법 초기화
resetSelected(1)
} }
//처마력바 체크 //처마력바 체크
@ -97,13 +97,24 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
}) })
setRaftCodes(raftCodeList) setRaftCodes(raftCodeList)
if (addRoof.raft) { // if (addRoof.raft) {
if (moduleSelectionData.roofConstructions.length > 0 && moduleSelectionData.roofConstructions[tabIndex].trestle.raftBaseCd) {
//서까래 선택 데이터가 있으면 선택된걸로
setSelectedRaftBase({ setSelectedRaftBase({
...selectedRaftBase, ...selectedRaftBase,
raftBaseCd: addRoof.raft, raftBaseCd: moduleSelectionData.roofConstructions[tabIndex].trestle.raftBaseCd,
clCode: addRoof.raft, clCode: moduleSelectionData.roofConstructions[tabIndex].trestle.raftBaseCd,
}) })
} else {
//없으면 기본값으로 넣는다
if (addRoof.raft) {
setSelectedRaftBase({
raftBaseCd: addRoof.raft,
clCode: addRoof.raft,
})
}
} }
// }
}, []) }, [])
//리코일에 데이터가 담기는 시점에 시작 //리코일에 데이터가 담기는 시점에 시작
@ -131,7 +142,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
setTrestleParams({ setTrestleParams({
moduleTpCd: selectedModules.itemTp, moduleTpCd: selectedModules.itemTp,
roofMatlCd: addRoof.roofMatlCd, roofMatlCd: addRoof.roofMatlCd,
raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '', raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
workingWidth: lengthBase, workingWidth: lengthBase,
}) })
} }
@ -145,7 +156,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
roofBaseCd: selectedRoofBase.roofBaseCd, roofBaseCd: selectedRoofBase.roofBaseCd,
inclCd: addRoof.pitch, inclCd: addRoof.pitch,
roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0, roofPitch: hajebichiRef.current ? hajebichiRef.current.value : 0,
raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '', raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
}) })
} }
}, [selectedRoofBase]) }, [selectedRoofBase])
@ -175,7 +186,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
setTrestleParams({ setTrestleParams({
moduleTpCd: selectedModules.itemTp, moduleTpCd: selectedModules.itemTp,
roofMatlCd: addRoof.roofMatlCd, roofMatlCd: addRoof.roofMatlCd,
raftBaseCd: selectedRaftBase.raftBaseCd ? selectedRaftBase.raftBaseCd : '', raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
workingWidth: lengthBase, workingWidth: lengthBase,
}) })
} }
@ -191,7 +202,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
//가대메이커 변경 함수 //가대메이커 변경 함수
const handleChangeTrestle = (option) => { const handleChangeTrestle = (option) => {
if (isObjectNotEmpty(option)) { if (isObjectNotEmpty(option)) {
option.raftBaseCd = selectedRaftBase.raftBaseCd option.raftBaseCd = selectedRaftBase.clCode
setSelectedTrestle(option) //선택값 저장 setSelectedTrestle(option) //선택값 저장
setConstructionParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' }) setConstructionParams({ ...trestleParams, trestleMkrCd: option.trestleMkrCd, constMthdCd: '', roofBaseCd: '' })
} }
@ -234,6 +245,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '', raftBaseCd: selectedRaftBase.clCode ? selectedRaftBase.clCode : '',
roofMatlCd: addRoof.roofMatlCd, roofMatlCd: addRoof.roofMatlCd,
}) })
option.raftBaseCd = selectedRaftBase.raftBaseCd
setSelectedRoofBase(option) setSelectedRoofBase(option)
} }
} }
@ -412,10 +424,12 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
construction: {}, construction: {},
}) })
const tempRoofConstructions = tempModuleSelectionData.roofConstructions.filter((item) => item.roofIndex !== tabIndex)
//임시 데이터 초기화 //임시 데이터 초기화
setTempModuleSelectionData({ setTempModuleSelectionData({
...moduleSelectionData, ...moduleSelectionData,
roofConstructions: [], roofConstructions: tempRoofConstructions,
}) })
//처마커버 해제 //처마커버 해제