Compare commits

..

No commits in common. "ce5022dfc14e2c5498a6a820391b0a808eb054fc" and "aa6ec20baa80db47862c9d0cf275c36649ed93f9" have entirely different histories.

View File

@ -766,19 +766,15 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
});
};
// const sortedWallLines = sortCurrentRoofLines(wall.lines);
const sortedWallLines = sortCurrentRoofLines(wall.lines);
// roofLines의 방향에 맞춰 currentRoofLines 조정 후 정렬
const alignedCurrentRoofLines = alignLineDirection(currentRoofLines, roofLines);
const sortedCurrentRoofLines = sortCurrentRoofLines(alignedCurrentRoofLines);
// const sortedRoofLines = sortCurrentRoofLines(roofLines);
const sortedRoofLines = sortCurrentRoofLines(roofLines);
const sortedWallBaseLines = sortCurrentRoofLines(wall.baseLines);
// const sortedBaseLines = sortBaseLinesByWallLines(wall.baseLines, wallLines);
const sortedBaseLines = sortBaseLinesByWallLines(wall.baseLines, wallLines);
const sortRoofLines = sortBaseLinesByWallLines(roofLines, wallLines);
// 원본 wallLines를 복사하여 사용
const sortedWallLines = [...wallLines];
const sortedBaseLines = sortBaseLinesByWallLines(wall.baseLines, sortedWallLines);
const sortedRoofLines = sortBaseLinesByWallLines(roofLines, sortedWallLines);
//wall.lines 는 기본 벽 라인
//wall.baseLine은 움직인라인
@ -880,7 +876,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
return line
}
//getAddLine(roofLine.startPoint, roofLine.endPoint, ) //외곽선을 그린다
getAddLine(roofLine.startPoint, roofLine.endPoint, )
newPStart = { x: roofLine.x1, y: roofLine.y1 }
newPEnd = { x: roofLine.x2, y: roofLine.y2 }
@ -1486,16 +1482,17 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
getAddLine(newPStart, newPEnd, 'red')
//canvas.remove(roofLine)
}else{
getAddLine(roofLine.startPoint, roofLine.endPoint, )
}
canvas.renderAll()
});
}
// const polygon = canvas.getObjects().find(obj => obj.type === 'QPolygon' && obj.id === roofId);
// if (polygon) {
// removeMatchingLines(polygon, wallLine);
// canvas.requestRenderAll();
// }
if (findPoints.length > 0) {
// 모든 점에 대해 라인 업데이트를 누적
return findPoints.reduce((innerLines, point) => {
@ -1503,6 +1500,42 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}, [...innerLines]);
}
const polygon = canvas.getObjects().find(obj => obj.type === 'QPolygon' && obj.id === roofId);
if (polygon && polygon.lines) {
// Find all lines that match your condition (e.g., stroke color)
const linesToRemoves = polygon.lines.filter(line =>
line.stroke === '#1083E3' // Your condition here
);
// Remove each matching line
linesToRemoves.forEach(lineToRemove => {
const index = polygon.lines.indexOf(lineToRemove);
if (index > -1) {
polygon.lines.splice(index, 1);
}
// Remove from canvas if needed
if (lineToRemove.canvas) {
lineToRemove.canvas.remove(lineToRemove);
}
});
// Update polygon points
const newPoints = polygon.lines.map(line => {
return { x: line.x1, y: line.y1 };
});
polygon.set({ points: newPoints });
polygon.initLines();
canvas.requestRenderAll();
}
// Usage
return innerLines;
}
@ -3478,4 +3511,38 @@ export const sortBaseLinesByWallLines = (baseLines, wallLines) => {
}
return sortedBaseLines;
};
};
function removeMatchingLines(polygon, roofLine) {
if (!polygon.lines) return;
// Find lines that match the roofLine coordinates
const linesToRemove = polygon.lines.filter(line => {
return (line.x1 === roofLine.x1 && line.y1 === roofLine.y1 &&
line.x2 === roofLine.x2 && line.y2 === roofLine.y2) ||
(line.x1 === roofLine.x2 && line.y1 === roofLine.y2 &&
line.x2 === roofLine.x1 && line.y2 === roofLine.y1);
});
// Remove the matching lines
linesToRemove.forEach(lineToRemove => {
const index = polygon.lines.indexOf(lineToRemove);
if (index > -1) {
polygon.lines.splice(index, 1);
}
if (lineToRemove.canvas) {
lineToRemove.canvas.remove(lineToRemove);
}
});
// Update polygon points
if (linesToRemove.length > 0) {
const newPoints = polygon.lines.map(line => {
return { x: line.x1, y: line.y1 };
});
polygon.set({ points: newPoints });
polygon.initLines();
}
}