할당완료
This commit is contained in:
parent
54ac757ced
commit
f8cc93d54e
@ -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]
|
||||
}
|
||||
|
||||
@ -844,7 +844,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length
|
||||
const nextIndex = (index + 1) % sortRoofLines.length
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
|
||||
if (Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
if (inLine) {
|
||||
@ -898,7 +898,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length;
|
||||
const nextIndex = (index + 1) % sortRoofLines.length;
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
|
||||
|
||||
if (Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||
@ -1014,7 +1014,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length
|
||||
const nextIndex = (index + 1) % sortRoofLines.length
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
|
||||
if (Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||
if (inLine) {
|
||||
@ -1068,7 +1068,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length;
|
||||
const nextIndex = (index + 1) % sortRoofLines.length;
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
|
||||
if (inLine) {
|
||||
if (inLine.x2 < inLine.x1) {
|
||||
@ -1203,7 +1203,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length;
|
||||
const nextIndex = (index + 1) % sortRoofLines.length;
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
|
||||
if (Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||
if (inLine) {
|
||||
@ -1255,7 +1255,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length;
|
||||
const nextIndex = (index + 1) % sortRoofLines.length;
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
|
||||
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||
if (inLine) {
|
||||
@ -1365,7 +1365,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length;
|
||||
const nextIndex = (index + 1) % sortRoofLines.length;
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
|
||||
if (Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||
if (inLine) {
|
||||
@ -1419,7 +1419,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
const prevIndex = (index - 1 + sortRoofLines.length) % sortRoofLines.length;
|
||||
const nextIndex = (index + 1) % sortRoofLines.length;
|
||||
const newLine = sortRoofLines[nextIndex]
|
||||
const newLine = sortRoofLines[prevIndex]
|
||||
|
||||
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||
if (inLine) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user