보조선 관련된 흡착점 추가
This commit is contained in:
parent
8226f6cf3d
commit
10d7a6476a
@ -132,7 +132,7 @@ export function useEvent() {
|
||||
const roofsPoints = roofs.map((roof) => roof.points).flat()
|
||||
roofAdsorptionPoints.current = [...roofsPoints]
|
||||
|
||||
const auxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine' && !obj.isFixed)
|
||||
const auxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine')
|
||||
const otherAdsorptionPoints = []
|
||||
|
||||
auxiliaryLines.forEach((line1) => {
|
||||
@ -179,7 +179,38 @@ export function useEvent() {
|
||||
|
||||
const allAuxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine')
|
||||
|
||||
const adsorptionPoints = [
|
||||
allAuxiliaryLines.forEach((aux) => {
|
||||
const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
|
||||
|
||||
roofs.forEach((roof) => {
|
||||
//지붕과 보조선이 만나는 지점
|
||||
roof.lines.forEach((line) => {
|
||||
const intersectionPoint = calculateIntersection(aux, line)
|
||||
if (intersectionPoint) {
|
||||
intersectionPoints.current.push(intersectionPoint)
|
||||
}
|
||||
})
|
||||
|
||||
//innerLines와 보조선이 만나는 지점
|
||||
roof.innerLines.forEach((line) => {
|
||||
const intersectionPoint = calculateIntersection(aux, line)
|
||||
if (intersectionPoint) {
|
||||
intersectionPoints.current.push(intersectionPoint)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// outerLines와의 교점
|
||||
const outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||
outerLines.forEach((outerLine) => {
|
||||
const intersectionPoint = calculateIntersection(aux, outerLine)
|
||||
if (intersectionPoint) {
|
||||
intersectionPoints.current.push(intersectionPoint)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
let adsorptionPoints = [
|
||||
...getAdsorptionPoints(),
|
||||
...roofAdsorptionPoints.current,
|
||||
...otherAdsorptionPoints,
|
||||
@ -200,6 +231,8 @@ export function useEvent() {
|
||||
}),
|
||||
]
|
||||
|
||||
adsorptionPoints = removeDuplicatePoints(adsorptionPoints)
|
||||
|
||||
if (dotLineGridSetting.LINE || canvas.getObjects().filter((obj) => ['lineGrid', 'tempGrid'].includes(obj.name)).length > 1) {
|
||||
const closestLine = getClosestLineGrid(pointer)
|
||||
|
||||
@ -451,6 +484,17 @@ export function useEvent() {
|
||||
})
|
||||
}
|
||||
|
||||
const removeDuplicatePoints = (points) => {
|
||||
const map = new Map()
|
||||
points.forEach((point) => {
|
||||
const key = `${point.x},${point.y}`
|
||||
if (!map.has(key)) {
|
||||
map.set(key, point)
|
||||
}
|
||||
})
|
||||
return Array.from(map.values())
|
||||
}
|
||||
|
||||
return {
|
||||
addDocumentEventListener,
|
||||
addCanvasMouseEventListener,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user