dev #267
@ -847,7 +847,8 @@ export const usePolygon = () => {
|
|||||||
// innerLine의 type을 polygonLine의 type으로 변경
|
// innerLine의 type을 polygonLine의 type으로 변경
|
||||||
if (polygonLine.attributes?.type && innerLine.attributes) {
|
if (polygonLine.attributes?.type && innerLine.attributes) {
|
||||||
polygonLine.need = false
|
polygonLine.need = false
|
||||||
innerLine.attributes.type = polygonLine.attributes.type
|
innerLine.attributes = polygonLine.attributes
|
||||||
|
innerLine.direction = polygonLine.direction
|
||||||
innerLine.attributes.isStart = true
|
innerLine.attributes.isStart = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -903,6 +904,28 @@ export const usePolygon = () => {
|
|||||||
line.endPoint = endPoint
|
line.endPoint = endPoint
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// polygonLines과 innerLines에서 startPoint, endPoint가 같은 라인을 innerLines에서 제거하고 canvas에서도 제거
|
||||||
|
const linesToRemove = []
|
||||||
|
innerLines = innerLines.filter((innerLine) => {
|
||||||
|
const shouldRemove = polygonLines.some((polygonLine) => {
|
||||||
|
return (
|
||||||
|
(isSamePoint(innerLine.startPoint, polygonLine.startPoint) && isSamePoint(innerLine.endPoint, polygonLine.endPoint)) ||
|
||||||
|
(isSamePoint(innerLine.startPoint, polygonLine.endPoint) && isSamePoint(innerLine.endPoint, polygonLine.startPoint))
|
||||||
|
)
|
||||||
|
})
|
||||||
|
if (shouldRemove) {
|
||||||
|
linesToRemove.push(innerLine)
|
||||||
|
}
|
||||||
|
return !shouldRemove
|
||||||
|
})
|
||||||
|
|
||||||
|
// 중복된 라인들을 canvas에서 제거
|
||||||
|
linesToRemove.forEach((line) => {
|
||||||
|
canvas.remove(line)
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
|
||||||
/*polygonLines.forEach((line) => {
|
/*polygonLines.forEach((line) => {
|
||||||
line.set({ strokeWidth: 10 })
|
line.set({ strokeWidth: 10 })
|
||||||
canvas.add(line)
|
canvas.add(line)
|
||||||
@ -1251,7 +1274,10 @@ export const usePolygon = () => {
|
|||||||
return (
|
return (
|
||||||
index ===
|
index ===
|
||||||
self.findIndex((l) => {
|
self.findIndex((l) => {
|
||||||
return isSamePoint(l.startPoint, line.startPoint) && isSamePoint(l.endPoint, line.endPoint)
|
return (
|
||||||
|
(isSamePoint(l.startPoint, line.startPoint) && isSamePoint(l.endPoint, line.endPoint)) ||
|
||||||
|
(isSamePoint(l.startPoint, line.endPoint) && isSamePoint(l.endPoint, line.startPoint))
|
||||||
|
)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user