할당처리
This commit is contained in:
parent
86e6cd7af6
commit
ac40a4a64c
@ -473,7 +473,20 @@ export function useRoofAllocationSetting(id) {
|
||||
// Filter out any eaveHelpLines that are already in lines to avoid duplicates
|
||||
const existingEaveLineIds = new Set(roofBase.lines.map((line) => line.id))
|
||||
const newEaveLines = roofEaveHelpLines.filter((line) => !existingEaveLineIds.has(line.id))
|
||||
roofBase.lines = [...newEaveLines]
|
||||
// Filter out lines from roofBase.lines that share any points with newEaveLines
|
||||
const linesToKeep = roofBase.lines.filter(roofLine => {
|
||||
return !newEaveLines.some(eaveLine => {
|
||||
// Check if any endpoint of roofLine matches any endpoint of eaveLine
|
||||
return (
|
||||
// Check if any endpoint of roofLine matches any endpoint of eaveLine
|
||||
(Math.abs(roofLine.x1 - eaveLine.x1) < 0.1 && Math.abs(roofLine.y1 - eaveLine.y1) < 0.1) || // p1 matches p1
|
||||
(Math.abs(roofLine.x2 - eaveLine.x2) < 0.1 && Math.abs(roofLine.y2 - eaveLine.y2) < 0.1) // p2 matches p2
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// Combine remaining lines with newEaveLines
|
||||
roofBase.lines = [...linesToKeep, ...newEaveLines];
|
||||
} else {
|
||||
roofBase.lines = [...roofEaveHelpLines]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user