지붕면할당 #736

Merged
ysCha merged 3 commits from dev into prd-deploy 2026-03-30 16:38:57 +09:00
2 changed files with 46 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import {
currentCanvasPlanState,
isManualModuleLayoutSetupState,
isManualModuleSetupState,
moduleSetupOptionState,
toggleManualSetupModeState,
} from '@/store/canvasAtom'
import { loginUserStore } from '@/store/commonAtom'
@ -47,6 +48,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
const [checkedModules, setCheckedModules] = useRecoilState(checkedModuleState)
const [roofs, setRoofs] = useState(addedRoofs)
const [manualSetupMode, setManualSetupMode] = useRecoilState(toggleManualSetupModeState)
const [moduleSetupOption, setModuleSetupOption] = useRecoilState(moduleSetupOptionState)
const [layoutSetup, setLayoutSetup] = useState([{}])
const {
selectedModules,
@ -211,8 +213,12 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
}
const handleManualModuleSetup = () => {
setManualSetupMode(`manualSetup_${!isManualModuleSetup}`)
setIsManualModuleSetup(!isManualModuleSetup)
const nextManual = !isManualModuleSetup
setManualSetupMode(`manualSetup_${nextManual}`)
setIsManualModuleSetup(nextManual)
if (nextManual) {
setModuleSetupOption((prev) => ({ ...prev, isChidori: true }))
}
}
const handleManualModuleLayoutSetup = () => {

View File

@ -463,6 +463,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => {
})
// 6. 마루이동(용마루 위치 수동 조정)이 설정된 경우 movingLineFromSkeleton 결과로 대체
if (moveFlowLine !== 0 || moveUpDown !== 0) {
const movedPoints = movingLineFromSkeleton(roofId, canvas)
console.log("movedPoints:::", movedPoints);
@ -981,6 +982,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
isIn = true
if (isStartEnd.start) {
console.log('left_in::::isStartEnd:::::', isStartEnd)
newPEnd.y = roofLine.y2
newPEnd.x = roofLine.x2
@ -1011,6 +1013,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('left_in::::isStartEnd:::::', isStartEnd)
newPStart.y = roofLine.y1
newPStart.x = roofLine.x1
@ -1100,6 +1103,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('left_in::::isStartEnd:::::', isStartEnd)
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
const bStartY = Big(wallLine.y2).plus(moveDist).toNumber()
@ -1161,6 +1165,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
} else if (condition === 'right_in') {
if (isStartEnd.start) {
console.log('right_in::::isStartEnd:::::', isStartEnd)
newPEnd.y = roofLine.y2
newPEnd.x = roofLine.x2
@ -1190,6 +1195,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('left_in::::isStartEnd:::::', isStartEnd)
newPStart.y = roofLine.y1
newPStart.x = roofLine.x1
@ -1359,6 +1365,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if (condition === 'top_in') {
if (isStartEnd.start) {
console.log('top_in start')
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
newPStart.x = wallBaseLine.x1
@ -1387,6 +1394,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('top_in end', isStartEnd)
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
newPEnd.x = wallBaseLine.x2
@ -1434,12 +1442,18 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// console.log('Creating extensionLine (Y1 > X1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1, y: roofLine.y1 + dist }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX1 - moveDistY1
// console.log('Creating extensionLine (X1 > Y1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1 - dist, y: roofLine.y1 }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
@ -1452,6 +1466,9 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// console.log('Creating extensionLine (Y2 > X2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2, y: roofLine.y2 + dist }, 'orange', 'extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX2 - moveDistY2
@ -1459,6 +1476,9 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// console.log('Creating extensionLine (X2 > Y2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2 + dist, y: roofLine.y2 }, 'orange', 'extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
@ -1524,6 +1544,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
getAddLine(newPStart, newPEnd, 'red')
}
if (isStartEnd.end) {
console.log('isStartEnd:::::', isStartEnd)
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const aStartX = Big(roofLine.x2).minus(moveDist).toNumber()
const bStartX = Big(wallLine.x2).minus(moveDist).toNumber()
@ -1581,7 +1602,9 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
getAddLine(newPStart, newPEnd, 'red')
}
} else if (condition === 'bottom_in') {
console.log('bottom_in::::isStartEnd:::::', isStartEnd)
if (isStartEnd.start) {
console.log('isStartEnd:::::', isStartEnd)
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
sPoint = { x: wallBaseLine.x1, y: wallBaseLine.y1 }
newPStart.x = wallBaseLine.x1
@ -1610,6 +1633,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('isStartEnd:::::', isStartEnd)
const moveDist = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
newPEnd.x = wallBaseLine.x2
@ -1659,12 +1683,18 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// console.log('Creating extensionLine (Y1 > X1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1, y: roofLine.y1 - dist }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX1 - moveDistY1
// console.log('Creating extensionLine (X1 > Y1):', { sPoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: sPoint.x, y: sPoint.y }, { x: roofLine.x1 + dist, y: roofLine.y1 }, 'orange','extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
@ -1677,6 +1707,9 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// console.log('Creating extensionLine (Y2 > X2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2, y: roofLine.y2 - dist }, 'orange', 'extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}else{
const dist = moveDistX2 - moveDistY2
@ -1684,6 +1717,9 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
// console.log('Creating extensionLine (X2 > Y2):', { ePoint, roofLine, dist, roofId })
const createdLine = getAddLine({ x: ePoint.x, y: ePoint.y }, { x: roofLine.x2 - dist, y: roofLine.y2 }, 'orange', 'extensionLine')
console.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 })
createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#1083E3', strokeWidth: 2 })
createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP }
innerLines.push(createdLine)
}
}
@ -1691,6 +1727,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
} else if (condition === 'bottom_out') {
console.log('bottom_out isStartEnd:::::::', isStartEnd)
if (isStartEnd.start) {
console.log('isStartEnd:::::::', isStartEnd)
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const aStartX = Big(roofLine.x1).minus(moveDist).toNumber()
const bStartX = Big(wallLine.x1).minus(moveDist).toNumber()
@ -1749,6 +1786,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
if (isStartEnd.end) {
console.log('isStartEnd:::::', isStartEnd)
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const aStartX = Big(roofLine.x2).plus(moveDist).toNumber()
const bStartX = Big(wallLine.x2).plus(moveDist).toNumber()