보조선 중복생성 line 제거

This commit is contained in:
hyojun.choi 2024-11-18 10:03:15 +09:00
parent 5ba9c19f3e
commit 7dc02514ad

View File

@ -455,9 +455,24 @@ export function useAuxiliaryDrawing(id) {
name: 'auxiliaryLine',
})
lineHistory.current.push(line)
const historyLines = [...lineHistory.current]
const hasSameLine = historyLines.some((history) => {
return (
(isSamePoint(history.startPoint, line.startPoint) && isSamePoint(history.endPoint, line.endPoint)) ||
(isSamePoint(history.startPoint, line.endPoint) && isSamePoint(history.endPoint, line.startPoint))
)
})
mousePointerArr.current = []
clear()
if (hasSameLine) {
canvas.remove(line)
return
}
lineHistory.current.push(line)
}
const mouseDown = (e) => {