From 306c71ead2be67643fac5be15f3fc29d3a8611af Mon Sep 17 00:00:00 2001 From: ysCha Date: Thu, 18 Dec 2025 18:05:08 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8F=99=EC=9D=B4=EB=8F=99=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/skeleton-utils.js | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/util/skeleton-utils.js b/src/util/skeleton-utils.js index de7bd91f..be4b066d 100644 --- a/src/util/skeleton-utils.js +++ b/src/util/skeleton-utils.js @@ -69,9 +69,9 @@ const movingLineFromSkeleton = (roofId, canvas) => { for (const line of oppositeLine) { if (line.position === 'left') { if (isSamePoint(newPoint, line.start)) { - newPoint.x = Big(line.start.x).plus(absMove).toNumber(); + newPoint.x = Big(line.start.x).plus(absMove).abs().toNumber(); } else if (isSamePoint(newPoint, line.end)) { - newPoint.x = Big(line.end.x).plus(absMove).toNumber(); + newPoint.x = Big(line.end.x).plus(absMove).abs().toNumber(); } break; @@ -196,7 +196,7 @@ const movingLineFromSkeleton = (roofId, canvas) => { // } }else if (moveDirection === 'out'){ if(isSamePoint(roof.basePoints[index], originalStartPoint) || isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.y = Big(point.y).plus(moveUpDownLength).toNumber(); + point.y = Big(point.y).plus(moveUpDownLength).abs().toNumber(); } // if (isSamePoint(roof.basePoints[index], originalEndPoint)) { // point.y = Big(point.y).plus(absMove).toNumber(); @@ -206,31 +206,31 @@ const movingLineFromSkeleton = (roofId, canvas) => { }else if (position === 'top'){ if(moveDirection === 'in'){ if(isSamePoint(roof.basePoints[index], originalStartPoint)) { - point.y = Big(point.y).plus(moveUpDownLength).toNumber(); + point.y = Big(point.y).plus(moveUpDownLength).abs().toNumber(); } if (isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.y = Big(point.y).plus(moveUpDownLength).toNumber(); + point.y = Big(point.y).plus(moveUpDownLength).abs().toNumber(); } }else if(moveDirection === 'out'){ if(isSamePoint(roof.basePoints[index], originalStartPoint)) { - point.y = Big(point.y).minus(moveUpDownLength).toNumber(); + point.y = Big(point.y).minus(moveUpDownLength).abs().toNumber(); } if (isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.y = Big(point.y).minus(moveUpDownLength).toNumber(); + point.y = Big(point.y).minus(moveUpDownLength).abs().toNumber(); } } }else if(position === 'left'){ if(moveDirection === 'in'){ if(isSamePoint(roof.basePoints[index], originalStartPoint) || isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.x = Big(point.x).plus(moveUpDownLength).toNumber(); + point.x = Big(point.x).plus(moveUpDownLength).abs().toNumber(); } // if (isSamePoint(roof.basePoints[index], originalEndPoint)) { // point.x = Big(point.x).plus(absMove).toNumber(); // } }else if(moveDirection === 'out'){ if(isSamePoint(roof.basePoints[index], originalStartPoint) || isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.x = Big(point.x).minus(moveUpDownLength).toNumber(); + point.x = Big(point.x).minus(moveUpDownLength).abs().toNumber(); } // if (isSamePoint(roof.basePoints[index], originalEndPoint)) { // point.x = Big(point.x).minus(absMove).toNumber(); @@ -243,14 +243,14 @@ const movingLineFromSkeleton = (roofId, canvas) => { point.x = Big(point.x).minus(moveUpDownLength).toNumber(); } if (isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.x = Big(point.x).minus(moveUpDownLength).toNumber(); + point.x = Big(point.x).minus(moveUpDownLength).abs().toNumber(); } }else if(moveDirection === 'out'){ if(isSamePoint(roof.basePoints[index], originalStartPoint)) { - point.x = Big(point.x).plus(moveUpDownLength).toNumber(); + point.x = Big(point.x).plus(moveUpDownLength).abs().toNumber(); } if (isSamePoint(roof.basePoints[index], originalEndPoint)) { - point.x = Big(point.x).plus(moveUpDownLength).toNumber(); + point.x = Big(point.x).plus(moveUpDownLength).abs().toNumber(); } } @@ -747,7 +747,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { const validWallLines = wallLines.filter((wallLine, index) => wallLine.idx - 1 === index); - validWallLines.forEach((wallLine, index) => { + wallLines.forEach((wallLine, index) => { const originalIndex = wallLines.indexOf(wallLine); const roofLine = sortRoofLines[originalIndex]; @@ -893,7 +893,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { newPEnd.y = wallBaseLine.y2 findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_end' }); - const newPointX = Big(roofLine.x1).plus(moveDist).toNumber() + const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber() const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber() const pLineY = Big(roofLine.y2).minus(0).abs().toNumber() let idx = (roofLines.length < index + 1)?0:index @@ -967,8 +967,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { if(isStartEnd.end){ const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber() - const aStartY = Big(roofLine.y2).plus(moveDist).toNumber() - const bStartY = Big(wallLine.y2).plus(moveDist).toNumber() + const aStartY = Big(roofLine.y2).plus(moveDist).abs().toNumber() + const bStartY = Big(wallLine.y2).plus(moveDist).abs().toNumber() const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 }) console.log("startLines:::::::", inLine); const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber() @@ -990,7 +990,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { findPoints.push({ y: aStartY, x: newPEnd.x, position: 'left_out_end' }); }else{ const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber() - newPEnd.y = Big(newPEnd.y).plus(cLineY).toNumber(); + newPEnd.y = Big(newPEnd.y).plus(cLineY).abs().toNumber(); const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x }) if(inLine){ if(inLine.x1 < inLine.x2) { @@ -1096,7 +1096,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { findPoints.push({ y: aStartY, x: newPEnd.x, position: 'right_out_start' }); }else{ const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber() - newPStart.y = Big(newPStart.y).plus(cLineY).toNumber(); + newPStart.y = Big(newPStart.y).plus(cLineY).abs().toNumber(); const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x }) if(inLine){ if(inLine.x2 < inLine.x1 ) { @@ -1200,7 +1200,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { newPStart.x = wallBaseLine.x1; - const newPointY = Big(roofLine.y2).plus(moveDist).toNumber() + const newPointY = Big(roofLine.y2).plus(moveDist).abs().toNumber() const pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber() const pLineX = Big(roofLine.x1).minus(0).abs().toNumber() @@ -1222,7 +1222,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 } newPEnd.x = wallBaseLine.x2 - const newPointY = Big(roofLine.y1).plus(moveDist).toNumber() + const newPointY = Big(roofLine.y1).plus(moveDist).abs().toNumber() const pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber() const pLineX = Big(roofLine.x2).minus(0).abs().toNumber() @@ -1245,8 +1245,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { if (isStartEnd.start ) { const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() - const aStartX = Big(roofLine.x1).plus(moveDist).toNumber() - const bStartX = Big(wallLine.x1).plus(moveDist).toNumber() + const aStartX = Big(roofLine.x1).plus(moveDist).abs().toNumber() + const bStartX = Big(wallLine.x1).plus(moveDist).abs().toNumber() const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y }) const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber() @@ -1268,7 +1268,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { findPoints.push({ x: aStartX, y: newPEnd.y, position: 'top_out_start' }); }else{ const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber() - newPStart.x = Big(newPStart.x).plus(cLineX).toNumber(); + newPStart.x = Big(newPStart.x).plus(cLineX).abs().toNumber(); const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x }) if(inLine){ if(inLine.y2 > inLine.y1 ) { @@ -1445,8 +1445,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { if(isStartEnd.end){ const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() - const aStartX = Big(roofLine.x2).plus(moveDist).toNumber() - const bStartX = Big(wallLine.x2).plus(moveDist).toNumber() + const aStartX = Big(roofLine.x2).plus(moveDist).abs().toNumber() + const bStartX = Big(wallLine.x2).plus(moveDist).abs().toNumber() const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 }) console.log("startLines:::::::", inLine); const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber() @@ -1468,7 +1468,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => { findPoints.push({ x: aStartX, y: newPEnd.y, position: 'bottom_out_end' }); }else{ const cLineX = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber() - newPEnd.x = Big(newPEnd.x).plus(cLineX).toNumber(); + newPEnd.x = Big(newPEnd.x).plus(cLineX).abs().toNumber(); const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x }) if(inLine){ if(inLine.y2 < inLine.y1 ) {