[1186, 1178] 동이동, 형이동 대응
This commit is contained in:
parent
3d4040e06c
commit
59539e4a60
@ -135,6 +135,7 @@ export function useMovementSetting(id) {
|
|||||||
const outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
const outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||||
outerLines.forEach((line) => line.set({ visible: true }))
|
outerLines.forEach((line) => line.set({ visible: true }))
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
initEvent()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@ -2768,6 +2768,70 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
/** 4각*/
|
/** 4각*/
|
||||||
if (prevLineRidge === nextLineRidge) {
|
if (prevLineRidge === nextLineRidge) {
|
||||||
polygonPoints.push({ x: ridgeLine.x1, y: ridgeLine.y1 }, { x: ridgeLine.x2, y: ridgeLine.y2 })
|
polygonPoints.push({ x: ridgeLine.x1, y: ridgeLine.y1 }, { x: ridgeLine.x2, y: ridgeLine.y2 })
|
||||||
|
/** 포인트가 직각 사각형인지 확인하여 아닌경우 직각인 다각형 포인트로 변경한다.*/
|
||||||
|
const checkPoints = getSortedPoint(polygonPoints, baseHipLines)
|
||||||
|
let hasDiagonal = false
|
||||||
|
if (checkPoints < 4) {
|
||||||
|
hasDiagonal = true
|
||||||
|
} else {
|
||||||
|
checkPoints.forEach((point, index) => {
|
||||||
|
const nextPoint = checkPoints[(index + 1) % checkPoints.length]
|
||||||
|
if (point.x !== nextPoint.x && point.y !== nextPoint.y) {
|
||||||
|
hasDiagonal = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (hasDiagonal) {
|
||||||
|
const vectorX = Math.sign(currentRoof.x1 - ridgeLine.x1)
|
||||||
|
const vectorY = Math.sign(currentRoof.y1 - ridgeLine.y1)
|
||||||
|
const ridgeMinX = Math.min(ridgeLine.x1, ridgeLine.x2)
|
||||||
|
const ridgeMaxX = Math.max(ridgeLine.x1, ridgeLine.x2)
|
||||||
|
const ridgeMinY = Math.min(ridgeLine.y1, ridgeLine.y2)
|
||||||
|
const ridgeMaxY = Math.max(ridgeLine.y1, ridgeLine.y2)
|
||||||
|
if (
|
||||||
|
(!isPointOnLineNew(prevRoof, { x: ridgeLine.x1, y: ridgeLine.y1 }) &&
|
||||||
|
!isPointOnLineNew(nextRoof, { x: ridgeLine.x1, y: ridgeLine.y1 })) ||
|
||||||
|
(!isPointOnLineNew(prevRoof, { x: ridgeLine.x2, y: ridgeLine.y2 }) && !isPointOnLineNew(nextRoof, { x: ridgeLine.x2, y: ridgeLine.y2 }))
|
||||||
|
) {
|
||||||
|
roof.lines
|
||||||
|
.filter((line) => line !== currentRoof && line !== prevRoof && line !== nextRoof)
|
||||||
|
.filter((line) =>
|
||||||
|
ridgeLine.y1 === ridgeLine.y2
|
||||||
|
? vectorY === Math.sign(line.y1 - ridgeLine.y1) &&
|
||||||
|
ridgeMinX <= line.x1 &&
|
||||||
|
line.x1 <= ridgeMaxX &&
|
||||||
|
ridgeMinX <= line.x2 &&
|
||||||
|
line.x2 <= ridgeMaxX
|
||||||
|
: vectorX === Math.sign(line.x1 - ridgeLine.x1) &&
|
||||||
|
ridgeMinY <= line.y1 &&
|
||||||
|
line.y1 <= ridgeMaxY &&
|
||||||
|
ridgeMinY <= line.y2 &&
|
||||||
|
line.y2 <= ridgeMaxY,
|
||||||
|
)
|
||||||
|
.forEach((line) => {
|
||||||
|
if (ridgeLine.y1 === ridgeLine.y2) {
|
||||||
|
if (vectorY === Math.sign(line.y1 - ridgeLine.y1)) {
|
||||||
|
polygonPoints.push({ x: line.x1, y: line.y1 })
|
||||||
|
}
|
||||||
|
if (vectorY === Math.sign(line.y2 - ridgeLine.y1)) {
|
||||||
|
polygonPoints.push({ x: line.x2, y: line.y2 })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (vectorX === Math.sign(line.x1 - ridgeLine.x1)) {
|
||||||
|
polygonPoints.push({ x: line.x1, y: line.y1 })
|
||||||
|
}
|
||||||
|
if (vectorX === Math.sign(line.x2 - ridgeLine.x1)) {
|
||||||
|
polygonPoints.push({ x: line.x2, y: line.y2 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!isPointOnLineNew(prevRoof, { x: ridgeLine.x2, y: ridgeLine.y2 }) &&
|
||||||
|
!isPointOnLineNew(nextRoof, { x: ridgeLine.x2, y: ridgeLine.y2 })
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/** 6각이상*/
|
/** 6각이상*/
|
||||||
let isOverLap =
|
let isOverLap =
|
||||||
@ -3427,6 +3491,7 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
|
|
||||||
const checkRidgePoint = checkRidgePoints.find((point) => point.checkPoint)
|
const checkRidgePoint = checkRidgePoints.find((point) => point.checkPoint)
|
||||||
|
|
||||||
|
if (!checkRidgePoint) return
|
||||||
/** 마루에서 현재라인으로 향하는 외벽선까지의 포인트를 확인 하여 처리*/
|
/** 마루에서 현재라인으로 향하는 외벽선까지의 포인트를 확인 하여 처리*/
|
||||||
let checkEdge
|
let checkEdge
|
||||||
if (currentVectorX === 0) {
|
if (currentVectorX === 0) {
|
||||||
@ -4123,7 +4188,7 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
|||||||
isOppNext,
|
isOppNext,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
const size = Big(isOppNext.x).minus(midx).abs().pow(2).plus(Big(isOppNext.y).minus(midY).abs().pow(2)).sqrt().toNumber()
|
const size = Big(isOppNext.x).minus(midX).abs().pow(2).plus(Big(isOppNext.y).minus(midY).abs().pow(2)).sqrt().toNumber()
|
||||||
ridgePoints.push({ x: isOppNext.x, y: isOppNext.y, size })
|
ridgePoints.push({ x: isOppNext.x, y: isOppNext.y, size })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user