Compare commits
2 Commits
aa6ec20baa
...
ce5022dfc1
| Author | SHA1 | Date | |
|---|---|---|---|
| ce5022dfc1 | |||
| 44b2f66a8f |
@ -766,15 +766,19 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortedWallLines = sortCurrentRoofLines(wall.lines);
|
// const sortedWallLines = sortCurrentRoofLines(wall.lines);
|
||||||
// roofLines의 방향에 맞춰 currentRoofLines 조정 후 정렬
|
// roofLines의 방향에 맞춰 currentRoofLines 조정 후 정렬
|
||||||
const alignedCurrentRoofLines = alignLineDirection(currentRoofLines, roofLines);
|
const alignedCurrentRoofLines = alignLineDirection(currentRoofLines, roofLines);
|
||||||
const sortedCurrentRoofLines = sortCurrentRoofLines(alignedCurrentRoofLines);
|
const sortedCurrentRoofLines = sortCurrentRoofLines(alignedCurrentRoofLines);
|
||||||
const sortedRoofLines = sortCurrentRoofLines(roofLines);
|
// const sortedRoofLines = sortCurrentRoofLines(roofLines);
|
||||||
const sortedWallBaseLines = sortCurrentRoofLines(wall.baseLines);
|
const sortedWallBaseLines = sortCurrentRoofLines(wall.baseLines);
|
||||||
const sortedBaseLines = sortBaseLinesByWallLines(wall.baseLines, wallLines);
|
// const sortedBaseLines = sortBaseLinesByWallLines(wall.baseLines, wallLines);
|
||||||
const sortRoofLines = sortBaseLinesByWallLines(roofLines, wallLines);
|
const sortRoofLines = sortBaseLinesByWallLines(roofLines, wallLines);
|
||||||
|
|
||||||
|
// 원본 wallLines를 복사하여 사용
|
||||||
|
const sortedWallLines = [...wallLines];
|
||||||
|
const sortedBaseLines = sortBaseLinesByWallLines(wall.baseLines, sortedWallLines);
|
||||||
|
const sortedRoofLines = sortBaseLinesByWallLines(roofLines, sortedWallLines);
|
||||||
|
|
||||||
//wall.lines 는 기본 벽 라인
|
//wall.lines 는 기본 벽 라인
|
||||||
//wall.baseLine은 움직인라인
|
//wall.baseLine은 움직인라인
|
||||||
@ -876,7 +880,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
return line
|
return line
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddLine(roofLine.startPoint, roofLine.endPoint, )
|
//getAddLine(roofLine.startPoint, roofLine.endPoint, ) //외곽선을 그린다
|
||||||
|
|
||||||
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
||||||
newPEnd = { x: roofLine.x2, y: roofLine.y2 }
|
newPEnd = { x: roofLine.x2, y: roofLine.y2 }
|
||||||
@ -1482,17 +1486,16 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
getAddLine(newPStart, newPEnd, 'red')
|
getAddLine(newPStart, newPEnd, 'red')
|
||||||
//canvas.remove(roofLine)
|
//canvas.remove(roofLine)
|
||||||
|
}else{
|
||||||
|
getAddLine(roofLine.startPoint, roofLine.endPoint, )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
canvas.renderAll()
|
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) {
|
if (findPoints.length > 0) {
|
||||||
// 모든 점에 대해 라인 업데이트를 누적
|
// 모든 점에 대해 라인 업데이트를 누적
|
||||||
return findPoints.reduce((innerLines, point) => {
|
return findPoints.reduce((innerLines, point) => {
|
||||||
@ -1500,42 +1503,6 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
}, [...innerLines]);
|
}, [...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;
|
return innerLines;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3511,38 +3478,4 @@ export const sortBaseLinesByWallLines = (baseLines, wallLines) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return sortedBaseLines;
|
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();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user