집추가작업
This commit is contained in:
parent
881fcb91f6
commit
37eab73aef
@ -543,28 +543,23 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
//const orgWallLine = wall.lines
|
//const orgWallLine = wall.lines
|
||||||
//console.log("outLine:::::", p1, p2, line)
|
//console.log("outLine:::::", p1, p2, line)
|
||||||
|
|
||||||
for(const orgLine of roof.lines){
|
let lineExists = false;
|
||||||
console.log("a::::",isSamePoint(p1,orgLine.startPoint), p1, orgLine.startPoint)
|
|
||||||
console.log("b::::",isSamePoint(p2,orgLine.endPoint), p2, orgLine.endPoint)
|
for (const orgLine of roof.lines) {
|
||||||
console.log("c::::",isSamePoint(p2,orgLine.startPoint), p2, orgLine.startPoint)
|
const sameDirection = isSamePoint(p1, orgLine.startPoint) && isSamePoint(p2, orgLine.endPoint);
|
||||||
console.log("d::::",isSamePoint(p1,orgLine.endPoint), p1, orgLine.endPoint)
|
const oppositeDirection = isSamePoint(p2, orgLine.startPoint) && isSamePoint(p1, orgLine.endPoint);
|
||||||
let isSampe1 = false
|
|
||||||
let isSampe2 = false
|
if (sameDirection || oppositeDirection) {
|
||||||
const orgOuterLine = orgLine
|
lineExists = true;
|
||||||
if(isSamePoint(p1,orgLine.startPoint) && isSamePoint(p2,orgLine.endPoint)){
|
break; // 같은 라인이 발견되면 즉시 순환 종료
|
||||||
isSampe1 = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
orgOuterLine.startPoint = orgLine.endPoint
|
if (!lineExists) {
|
||||||
orgOuterLine.endPoint = orgLine.startPoint
|
// 같은 라인이 없으므로 새 다각형 라인 생성
|
||||||
|
const newLine = new QLine(
|
||||||
if(isSamePoint(p1,orgLine.endPoint) && isSamePoint(p2,orgLine.startPoint)){
|
[p1.x, p1.y, p2.x, p2.y],
|
||||||
isSampe2 = true
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const innerLine2 = new QLine([orgOuterLine.startPoint.x, orgOuterLine.startPoint.y, orgOuterLine.endPoint.x, orgOuterLine.endPoint.y], {
|
|
||||||
parentId : roof.id,
|
parentId : roof.id,
|
||||||
fontSize : roof.fontSize,
|
fontSize : roof.fontSize,
|
||||||
stroke : 'yellow',
|
stroke : 'yellow',
|
||||||
@ -576,28 +571,35 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
lineName : (line.attributes.isOuterEdge) ? 'addLine' : attributes.type,
|
lineName : (line.attributes.isOuterEdge) ? 'addLine' : attributes.type,
|
||||||
selectable : (!line.attributes.isOuterEdge),
|
selectable : (!line.attributes.isOuterEdge),
|
||||||
roofId : roofId,
|
roofId : roofId,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
//orgOuterLine.setCoords()
|
let p1Line = findClosestRoofLine(p1, roof.lines)
|
||||||
//canvas.renderAll()
|
let p2Line = findClosestRoofLine(p2, roof.lines)
|
||||||
canvas.add(innerLine2);
|
if(p2Line.distance > p1Line.distance){
|
||||||
|
p1Line = p2Line;
|
||||||
|
p2Line = p1Line;
|
||||||
}
|
}
|
||||||
|
const newLine2 = new QLine(
|
||||||
|
[p1Line.line.x1, p1Line.line.y1, p2Line.line.x2, p2Line.line.y2],
|
||||||
|
{
|
||||||
for(const orgWallLine of wall.lines){
|
parentId : roof.id,
|
||||||
// console.log("orgWallLine::::;",orgWallLine.startPoint, orgWallLine.endPoint);
|
fontSize : roof.fontSize,
|
||||||
// if(isSamePoint(orgWallLine.startPoint, p1) ||
|
stroke : 'red',
|
||||||
// isSamePoint(orgWallLine.endPoint, p2) ||
|
strokeWidth: lineStyle.width,
|
||||||
// isSamePoint(orgWallLine.endPoint, p1) ||
|
name : (line.attributes.isOuterEdge) ? 'eaves' : attributes.type,
|
||||||
// isSamePoint(orgWallLine.startPoint, p2)){
|
attributes : attributes,
|
||||||
// idx = orgWallLine.idx
|
direction : direction,
|
||||||
// break
|
isBaseLine : line.attributes.isOuterEdge,
|
||||||
// }
|
lineName : (line.attributes.isOuterEdge) ? 'exLine' : attributes.type,
|
||||||
|
selectable : (!line.attributes.isOuterEdge),
|
||||||
|
roofId : roofId,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
canvas.add(newLine);
|
||||||
|
canvas.add(newLine2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//초기외곽라인?
|
//초기외곽라인?
|
||||||
const coordinateText = new fabric.Text(`(${Math.round(p1.x)}, ${Math.round(p1.y)})`, {
|
const coordinateText = new fabric.Text(`(${Math.round(p1.x)}, ${Math.round(p1.y)})`, {
|
||||||
left: p1.x + 5, // 좌표점에서 약간 오른쪽으로 이동
|
left: p1.x + 5, // 좌표점에서 약간 오른쪽으로 이동
|
||||||
@ -617,6 +619,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
canvas?.add(coordinateText)
|
canvas?.add(coordinateText)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
canvas.add(innerLine);
|
canvas.add(innerLine);
|
||||||
innerLine.bringToFront();
|
innerLine.bringToFront();
|
||||||
existingLines.add(lineKey); // 추가된 라인을 추적
|
existingLines.add(lineKey); // 추가된 라인을 추적
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user