보조선 자르기 로직 추가

This commit is contained in:
hyojun.choi 2024-11-04 15:15:36 +09:00
parent c60db3cda5
commit 19e22ba9ea
2 changed files with 31 additions and 1 deletions

View File

@ -616,6 +616,37 @@ export function useAuxiliaryDrawing(id) {
removeLine(line1) removeLine(line1)
intersectionPoints.current.push(...interSectionPointsWithRoofLines) intersectionPoints.current.push(...interSectionPointsWithRoofLines)
return return
} else if (interSectionPointsWithRoofLines.length === 1) {
//지붕선과 만나는 점이 하나일 경우
const distance1 = distanceBetweenPoints({ x: line1.x1, y: line1.y1 }, interSectionPointsWithRoofLines[0])
const distance2 = distanceBetweenPoints({ x: line1.x2, y: line1.y2 }, interSectionPointsWithRoofLines[0])
if (!(distance1 === 0 || distance2 === 0)) {
if (distance1 >= distance2) {
const newLine = addLine([line1.x1, line1.y1, interSectionPointsWithRoofLines[0].x, interSectionPointsWithRoofLines[0].y], {
stroke: 'black',
strokeWidth: 1,
selectable: false,
name: 'auxiliaryLine',
isFixed: true,
})
lineHistory.current.push(newLine)
lineHistory.current = lineHistory.current.filter((history) => history !== line1)
removeLine(line1)
} else {
const newLine = addLine([line1.x2, line1.y2, interSectionPointsWithRoofLines[0].x, interSectionPointsWithRoofLines[0].y], {
stroke: 'black',
strokeWidth: 1,
selectable: false,
name: 'auxiliaryLine',
isFixed: true,
})
lineHistory.current.push(newLine)
lineHistory.current = lineHistory.current.filter((history) => history !== line1)
removeLine(line1)
}
intersectionPoints.current.push(interSectionPointsWithRoofLines[0])
}
} }
//보조선과 만나는 점을 찾는다. //보조선과 만나는 점을 찾는다.

View File

@ -1461,7 +1461,6 @@ export const drawRidgeRoof = (roofId, canvas) => {
* @param canvas * @param canvas
*/ */
const drawRidge = (roof, canvas) => { const drawRidge = (roof, canvas) => {
debugger
const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines // 외벽의 라인 const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines // 외벽의 라인
const roofLines = roof.lines // 지붕의 라인 const roofLines = roof.lines // 지붕의 라인
let ridgeRoof = [] let ridgeRoof = []