서까래 수정

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 moduleSelectionData = useRecoilValue(moduleSelectionDataState) //
const [selectedItems, setSelectedItems] = useState({})
const { makeModuleInitArea } = useModuleBasicSetting(3)
useEffect(() => {
if (moduleSelectionData) {
makeModuleInitArea(moduleSelectionData)
}
}, [])
useEffect(() => {
handleChangeSetupLocation()

View File

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

View File

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