할당2
This commit is contained in:
parent
0718bf052f
commit
b42142888e
@ -892,6 +892,7 @@ if(roof.moveUpDown??0 > 0) {
|
|||||||
//추가 수직
|
//추가 수직
|
||||||
getAddLine({ x: wallBaseLine.x1, y: newPEnd.y }, { x: wallBaseLine.x1, y: wallBaseLine.y1 }, )
|
getAddLine({ x: wallBaseLine.x1, y: newPEnd.y }, { x: wallBaseLine.x1, y: wallBaseLine.y1 }, )
|
||||||
//추가 라인?
|
//추가 라인?
|
||||||
|
|
||||||
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||||
|
|
||||||
} else if (wallBaseLine.x2 <= newPEnd.x && newPEnd.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x) { //top right
|
} else if (wallBaseLine.x2 <= newPEnd.x && newPEnd.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x) { //top right
|
||||||
@ -946,11 +947,16 @@ if(roof.moveUpDown??0 > 0) {
|
|||||||
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
||||||
newPEnd = { x: roofLine.x2, y: (isCross) ? currentRoofLine.y1 : wallBaseLine.y1 }
|
newPEnd = { x: roofLine.x2, y: (isCross) ? currentRoofLine.y1 : wallBaseLine.y1 }
|
||||||
|
|
||||||
}else if(newPEnd.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPStart.y && newPStart.y <= wallBaseLine.y1) { //상단 왼쪽v
|
}else if(newPEnd.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPStart.y && newPStart.y <= wallBaseLine.y1) { //top right
|
||||||
|
|
||||||
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y1 : wallBaseLine.y1 }
|
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y1 : wallBaseLine.y1 }
|
||||||
newPEnd ={ x: roofLine.x2, y: roofLine.y2 }
|
newPEnd ={ x: roofLine.x2, y: roofLine.y2 }
|
||||||
|
|
||||||
|
//대각선 라인을 보조라인으로 그린다.
|
||||||
|
if(isCross){
|
||||||
|
getAddLine({ x: roofLine.x1, y: currentRoofLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 }, 'yellow')
|
||||||
|
}
|
||||||
|
|
||||||
}else if(newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) {//상단 오르쪽
|
}else if(newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) {//상단 오르쪽
|
||||||
|
|
||||||
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
||||||
@ -1017,7 +1023,7 @@ if(roof.moveUpDown??0 > 0) {
|
|||||||
|
|
||||||
} else if (movedEnd) { //start변경
|
} else if (movedEnd) { //start변경
|
||||||
|
|
||||||
//반시계방향
|
//반시계방향 오렌지
|
||||||
|
|
||||||
|
|
||||||
if (getOrientation(roofLine) === 'vertical') {
|
if (getOrientation(roofLine) === 'vertical') {
|
||||||
@ -1035,6 +1041,8 @@ if(roof.moveUpDown??0 > 0) {
|
|||||||
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y2 : wallBaseLine.y2 }
|
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y2 : wallBaseLine.y2 }
|
||||||
newPEnd = { x: roofLine.x2, y: roofLine.y2 }
|
newPEnd = { x: roofLine.x2, y: roofLine.y2 }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else if(newPEnd.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPStart.y && newPStart.y <= wallBaseLine.y1) { //top / left
|
}else if(newPEnd.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPStart.y && newPStart.y <= wallBaseLine.y1) { //top / left
|
||||||
|
|
||||||
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y2 : wallBaseLine.y2 }
|
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y2 : wallBaseLine.y2 }
|
||||||
@ -1044,10 +1052,12 @@ if(roof.moveUpDown??0 > 0) {
|
|||||||
|
|
||||||
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
newPStart = { x: roofLine.x1, y: roofLine.y1 }
|
||||||
newPEnd = { x: roofLine.x2, y: (isCross) ? currentRoofLine.y2 : wallBaseLine.y2 }
|
newPEnd = { x: roofLine.x2, y: (isCross) ? currentRoofLine.y2 : wallBaseLine.y2 }
|
||||||
|
|
||||||
//대각선 라인을 보조라인으로 그린다.
|
//대각선 라인을 보조라인으로 그린다.
|
||||||
if(isCross){
|
if(isCross){
|
||||||
getAddLine({ x: roofLine.x2, y: currentRoofLine.y2 }, { x: roofLine.x2, y: roofLine.y2 }, 'red')
|
getAddLine({ x: roofLine.x2, y: currentRoofLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 }, 'yellow')
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(wallBaseLine.y1 <= newPStart.y && newPStart.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPEnd.y) { //하단 오른쪽v
|
}else if(wallBaseLine.y1 <= newPStart.y && newPStart.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPEnd.y) { //하단 오른쪽v
|
||||||
|
|
||||||
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y1 : wallBaseLine.y1 }
|
newPStart = { x: roofLine.x1, y: (isCross) ? currentRoofLine.y1 : wallBaseLine.y1 }
|
||||||
@ -1128,9 +1138,10 @@ if(roof.moveUpDown??0 > 0) {
|
|||||||
// canvas.renderAll
|
// canvas.renderAll
|
||||||
if (findPoints.length > 0) {
|
if (findPoints.length > 0) {
|
||||||
// 모든 점에 대해 라인 업데이트를 누적
|
// 모든 점에 대해 라인 업데이트를 누적
|
||||||
return findPoints.reduce((lines, point) => {
|
// return findPoints.reduce((lines, point) => {
|
||||||
return updateAndAddLine(lines, point);
|
// return updateAndAddLine(lines, point);
|
||||||
}, [...innerLines]);
|
// }, [...innerLines]);
|
||||||
|
return updateAndAddLine(innerLines, findPoints[0]);
|
||||||
}
|
}
|
||||||
return innerLines;
|
return innerLines;
|
||||||
|
|
||||||
@ -1842,7 +1853,11 @@ const isPointOnSegment = (point, segStart, segEnd) => {
|
|||||||
export {
|
export {
|
||||||
findAllIntersections,
|
findAllIntersections,
|
||||||
collectAllPoints,
|
collectAllPoints,
|
||||||
createPolygonsFromSkeletonLines
|
createPolygonsFromSkeletonLines,
|
||||||
|
preprocessPolygonCoordinates,
|
||||||
|
findOppositeLine,
|
||||||
|
createOrderedBasePoints,
|
||||||
|
createInnerLinesFromSkeleton
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3845,23 +3860,29 @@ function updateAndAddLine(innerLines, targetPoint) {
|
|||||||
line.y2 === foundLine.y2)
|
line.y2 === foundLine.y2)
|
||||||
);
|
);
|
||||||
|
|
||||||
const updatedLine = {
|
let isCurrentLine = false;
|
||||||
...foundLine,
|
if(foundLine.y1 <= targetPoint.y && targetPoint.y <= foundLine.y2){
|
||||||
x1: targetPoint.x,
|
isCurrentLine = true;
|
||||||
y1: targetPoint.y,
|
}
|
||||||
x2: foundLine.x2,
|
const updatedLine = {
|
||||||
y2: foundLine.y2,
|
...foundLine,
|
||||||
startPoint: { x: targetPoint.x, y: targetPoint.y },
|
left: (isCurrentLine)?targetPoint.x:foundLine.left,
|
||||||
endPoint: foundLine.endPoint || { x: foundLine.x2, y: foundLine.y2 }
|
top: (isCurrentLine)?targetPoint.y:foundLine.top,
|
||||||
};
|
x1: (isCurrentLine)?targetPoint.x:foundLine.x1,
|
||||||
|
y1: (isCurrentLine)?targetPoint.y:foundLine.y1,
|
||||||
|
x2: (isCurrentLine)?foundLine.x2:targetPoint.x,
|
||||||
|
y2: (isCurrentLine)?foundLine.y2:targetPoint.y,
|
||||||
|
startPoint: (isCurrentLine)?{ x: targetPoint.x, y: targetPoint.y }:foundLine.startPoint,
|
||||||
|
endPoint: (isCurrentLine)?foundLine.endPoint : { x: targetPoint.x, y: targetPoint.y}
|
||||||
|
};
|
||||||
|
|
||||||
// 4. If it's a Fabric.js object, use set method if available
|
// 4. If it's a Fabric.js object, use set method if available
|
||||||
if (typeof foundLine.set === 'function') {
|
if (typeof foundLine.set === 'function') {
|
||||||
foundLine.set({
|
foundLine.set({
|
||||||
x1: targetPoint.x,
|
x1: (isCurrentLine)?targetPoint.x:foundLine.x1,
|
||||||
y1: targetPoint.y,
|
y1: (isCurrentLine)?targetPoint.y:foundLine.y1,
|
||||||
x2: foundLine.x2,
|
x2: (isCurrentLine)?foundLine.x2:targetPoint.x,
|
||||||
y2: foundLine.y2
|
y2: (isCurrentLine)?foundLine.y2:targetPoint.y,
|
||||||
});
|
});
|
||||||
updatedLines.push(foundLine);
|
updatedLines.push(foundLine);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user