동선이동 수정
This commit is contained in:
parent
c58146ca53
commit
46710533b5
@ -411,6 +411,35 @@ export function useMovementSetting(id) {
|
|||||||
|
|
||||||
targetBaseLines.sort((a, b) => a.distance - b.distance)
|
targetBaseLines.sort((a, b) => a.distance - b.distance)
|
||||||
targetBaseLines = targetBaseLines.filter((line) => line.distance === targetBaseLines[0].distance)
|
targetBaseLines = targetBaseLines.filter((line) => line.distance === targetBaseLines[0].distance)
|
||||||
|
|
||||||
|
if (isGableRoof) {
|
||||||
|
const zeroLengthLines = targetBaseLines.filter(
|
||||||
|
(line) => Math.sqrt(Math.pow(line.line.x2 - line.line.x1, 2) + Math.pow(line.line.y2 - line.line.y1, 2)) < 1,
|
||||||
|
)
|
||||||
|
if (zeroLengthLines.length > 0) {
|
||||||
|
zeroLengthLines.forEach((line) => {
|
||||||
|
const findLine = line.line
|
||||||
|
const findCoords = [
|
||||||
|
{ x: findLine.x1, y: findLine.y1 },
|
||||||
|
{ x: findLine.x2, y: findLine.y2 },
|
||||||
|
]
|
||||||
|
wall.baseLines
|
||||||
|
.filter((baseLine) => {
|
||||||
|
return findCoords.some(
|
||||||
|
(coord) =>
|
||||||
|
(Math.abs(coord.x - baseLine.x1) < 0.1 && Math.abs(coord.y - baseLine.y1) < 0.1) ||
|
||||||
|
(Math.abs(coord.x - baseLine.x2) < 0.1 && Math.abs(coord.y - baseLine.y2) < 0.1),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.forEach((baseLine) => {
|
||||||
|
const isAlready = targetBaseLines.find((target) => target.line === baseLine)
|
||||||
|
if (isAlready) return
|
||||||
|
targetBaseLines.push({ line: baseLine, distance: targetBaseLines[0].distance })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let value
|
let value
|
||||||
if (typeRef.current === TYPE.FLOW_LINE) {
|
if (typeRef.current === TYPE.FLOW_LINE) {
|
||||||
value =
|
value =
|
||||||
@ -445,58 +474,56 @@ export function useMovementSetting(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = value.div(10)
|
value = value.div(10)
|
||||||
targetBaseLines.forEach((target) => {
|
targetBaseLines
|
||||||
const currentLine = target.line
|
.filter((line) => Math.sqrt(Math.pow(line.line.x2 - line.line.x1, 2) + Math.pow(line.line.y2 - line.line.y1, 2)) >= 1)
|
||||||
const index = baseLines.findIndex((line) => line === currentLine)
|
.forEach((target) => {
|
||||||
const nextLine = baseLines[(index + 1) % baseLines.length]
|
const currentLine = target.line
|
||||||
const prevLine = baseLines[(index - 1 + baseLines.length) % baseLines.length]
|
const index = baseLines.findIndex((line) => line === currentLine)
|
||||||
let deltaX = 0
|
const nextLine = baseLines[(index + 1) % baseLines.length]
|
||||||
let deltaY = 0
|
const prevLine = baseLines[(index - 1 + baseLines.length) % baseLines.length]
|
||||||
if (currentLine.y1 === currentLine.y2) {
|
let deltaX = 0
|
||||||
deltaY = value.toNumber()
|
let deltaY = 0
|
||||||
} else {
|
if (currentLine.y1 === currentLine.y2) {
|
||||||
deltaX = value.toNumber()
|
deltaY = value.toNumber()
|
||||||
}
|
} else {
|
||||||
|
deltaX = value.toNumber()
|
||||||
|
}
|
||||||
|
|
||||||
currentLine.set({
|
currentLine.set({
|
||||||
x1: currentLine.x1 + deltaX,
|
x1: currentLine.x1 + deltaX,
|
||||||
y1: currentLine.y1 + deltaY,
|
y1: currentLine.y1 + deltaY,
|
||||||
x2: currentLine.x2 + deltaX,
|
x2: currentLine.x2 + deltaX,
|
||||||
y2: currentLine.y2 + deltaY,
|
y2: currentLine.y2 + deltaY,
|
||||||
startPoint: { x: currentLine.x1 + deltaX, y: currentLine.y1 + deltaY },
|
startPoint: { x: currentLine.x1 + deltaX, y: currentLine.y1 + deltaY },
|
||||||
endPoint: { x: currentLine.x2 + deltaX, y: currentLine.y2 + deltaY },
|
endPoint: { x: currentLine.x2 + deltaX, y: currentLine.y2 + deltaY },
|
||||||
})
|
})
|
||||||
const currentSize = calcLinePlaneSize({
|
const currentSize = calcLinePlaneSize({
|
||||||
x1: currentLine.x1,
|
x1: currentLine.x1,
|
||||||
y1: currentLine.y1,
|
y1: currentLine.y1,
|
||||||
x2: currentLine.x2,
|
x2: currentLine.x2,
|
||||||
y2: currentLine.y2,
|
y2: currentLine.y2,
|
||||||
})
|
})
|
||||||
currentLine.attributes.planeSize = currentSize
|
currentLine.attributes.planeSize = currentSize
|
||||||
currentLine.attributes.actualSize = currentSize
|
currentLine.attributes.actualSize = currentSize
|
||||||
|
|
||||||
const nextOldActualSize = nextLine.attributes.planeSize
|
nextLine.set({
|
||||||
nextLine.set({
|
x1: currentLine.x2,
|
||||||
x1: nextLine.x1 + deltaX,
|
y1: currentLine.y2,
|
||||||
y1: nextLine.y1 + deltaY,
|
startPoint: { x: currentLine.x2, y: currentLine.y2 },
|
||||||
startPoint: { x: nextLine.x1 + deltaX, y: nextLine.y1 + deltaY },
|
})
|
||||||
})
|
const nextSize = calcLinePlaneSize({ x1: nextLine.x1, y1: nextLine.y1, x2: nextLine.x2, y2: nextLine.y2 })
|
||||||
const nextSize = calcLinePlaneSize({ x1: nextLine.x1, y1: nextLine.y1, x2: nextLine.x2, y2: nextLine.y2 })
|
nextLine.attributes.planeSize = nextSize
|
||||||
nextLine.attributes.planeSize = nextSize
|
nextLine.attributes.actualSize = nextSize
|
||||||
nextLine.attributes.actualSize = nextSize
|
|
||||||
|
|
||||||
const prevOldActualSize = prevLine.attributes.planeSize
|
prevLine.set({
|
||||||
prevLine.set({
|
x2: currentLine.x1,
|
||||||
x2: prevLine.x2 + deltaX,
|
y2: currentLine.y1,
|
||||||
y2: prevLine.y2 + deltaY,
|
endPoint: { x: currentLine.x1, y: currentLine.y1 },
|
||||||
endPoint: { x: prevLine.x2 + deltaX, y: prevLine.y2 + deltaY },
|
})
|
||||||
|
const prevSize = calcLinePlaneSize({ x1: prevLine.x1, y1: prevLine.y1, x2: prevLine.x2, y2: prevLine.y2 })
|
||||||
|
prevLine.attributes.planeSize = prevSize
|
||||||
|
prevLine.attributes.actualSize = prevSize
|
||||||
})
|
})
|
||||||
const prevSize = calcLinePlaneSize({ x1: prevLine.x1, y1: prevLine.y1, x2: prevLine.x2, y2: prevLine.y2 })
|
|
||||||
prevLine.attributes.planeSize = prevSize
|
|
||||||
prevLine.attributes.actualSize = prevSize
|
|
||||||
|
|
||||||
canvas.renderAll()
|
|
||||||
})
|
|
||||||
|
|
||||||
roof.drawHelpLine()
|
roof.drawHelpLine()
|
||||||
initEvent()
|
initEvent()
|
||||||
|
|||||||
@ -600,9 +600,10 @@ export const drawGableRoof = (roofId, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let currentRoof = intersectRoofLines.find((roof) => isPointOnLineNew(roof.roofLine, roof.intersect))
|
intersectRoofLines.sort((a, b) => a.length - b.length)
|
||||||
|
let currentRoof = intersectRoofLines.find((roof) => isPointOnLineNew(roof.roofLine, roof.intersect) && roof.length - offset < 0.1)
|
||||||
if (!currentRoof) {
|
if (!currentRoof) {
|
||||||
currentRoof = intersectRoofLines.sort((a, b) => a.length - b.length)[0]
|
currentRoof = intersectRoofLines[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
let startPoint, endPoint
|
let startPoint, endPoint
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user