Compare commits

..

No commits in common. "1d1ad5f69fdd636a7581e144aa7a4d16da0ebdd4" and "e1323cd156c968fde4a816dabd38901f0015f856" have entirely different histories.

View File

@ -847,8 +847,7 @@ 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 = polygonLine.attributes innerLine.attributes.type = polygonLine.attributes.type
innerLine.direction = polygonLine.direction
innerLine.attributes.isStart = true innerLine.attributes.isStart = true
} }
} }
@ -904,28 +903,6 @@ 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)
@ -1274,10 +1251,7 @@ export const usePolygon = () => {
return ( return (
index === index ===
self.findIndex((l) => { self.findIndex((l) => {
return ( return isSamePoint(l.startPoint, line.startPoint) && isSamePoint(l.endPoint, line.endPoint)
(isSamePoint(l.startPoint, line.startPoint) && isSamePoint(l.endPoint, line.endPoint)) ||
(isSamePoint(l.startPoint, line.endPoint) && isSamePoint(l.endPoint, line.startPoint))
)
}) })
) )
}) })