동이동변경

This commit is contained in:
ysCha 2025-12-18 18:05:08 +09:00
parent 7be6b60e12
commit 306c71ead2

View File

@ -69,9 +69,9 @@ const movingLineFromSkeleton = (roofId, canvas) => {
for (const line of oppositeLine) { for (const line of oppositeLine) {
if (line.position === 'left') { if (line.position === 'left') {
if (isSamePoint(newPoint, line.start)) { 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)) { } 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; break;
@ -196,7 +196,7 @@ const movingLineFromSkeleton = (roofId, canvas) => {
// } // }
}else if (moveDirection === 'out'){ }else if (moveDirection === 'out'){
if(isSamePoint(roof.basePoints[index], originalStartPoint) || isSamePoint(roof.basePoints[index], originalEndPoint)) { 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)) { // if (isSamePoint(roof.basePoints[index], originalEndPoint)) {
// point.y = Big(point.y).plus(absMove).toNumber(); // point.y = Big(point.y).plus(absMove).toNumber();
@ -206,31 +206,31 @@ const movingLineFromSkeleton = (roofId, canvas) => {
}else if (position === 'top'){ }else if (position === 'top'){
if(moveDirection === 'in'){ if(moveDirection === 'in'){
if(isSamePoint(roof.basePoints[index], originalStartPoint)) { 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)) { 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'){ }else if(moveDirection === 'out'){
if(isSamePoint(roof.basePoints[index], originalStartPoint)) { 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)) { 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'){ }else if(position === 'left'){
if(moveDirection === 'in'){ if(moveDirection === 'in'){
if(isSamePoint(roof.basePoints[index], originalStartPoint) || isSamePoint(roof.basePoints[index], originalEndPoint)) { 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)) { // if (isSamePoint(roof.basePoints[index], originalEndPoint)) {
// point.x = Big(point.x).plus(absMove).toNumber(); // point.x = Big(point.x).plus(absMove).toNumber();
// } // }
}else if(moveDirection === 'out'){ }else if(moveDirection === 'out'){
if(isSamePoint(roof.basePoints[index], originalStartPoint) || isSamePoint(roof.basePoints[index], originalEndPoint)) { 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)) { // if (isSamePoint(roof.basePoints[index], originalEndPoint)) {
// point.x = Big(point.x).minus(absMove).toNumber(); // point.x = Big(point.x).minus(absMove).toNumber();
@ -243,14 +243,14 @@ const movingLineFromSkeleton = (roofId, canvas) => {
point.x = Big(point.x).minus(moveUpDownLength).toNumber(); point.x = Big(point.x).minus(moveUpDownLength).toNumber();
} }
if (isSamePoint(roof.basePoints[index], originalEndPoint)) { 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'){ }else if(moveDirection === 'out'){
if(isSamePoint(roof.basePoints[index], originalStartPoint)) { 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)) { 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); const validWallLines = wallLines.filter((wallLine, index) => wallLine.idx - 1 === index);
validWallLines.forEach((wallLine, index) => { wallLines.forEach((wallLine, index) => {
const originalIndex = wallLines.indexOf(wallLine); const originalIndex = wallLines.indexOf(wallLine);
const roofLine = sortRoofLines[originalIndex]; const roofLine = sortRoofLines[originalIndex];
@ -893,7 +893,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
newPEnd.y = wallBaseLine.y2 newPEnd.y = wallBaseLine.y2
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_end' }); 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 pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber() const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
let idx = (roofLines.length < index + 1)?0:index let idx = (roofLines.length < index + 1)?0:index
@ -967,8 +967,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if(isStartEnd.end){ if(isStartEnd.end){
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber() const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber() const aStartY = Big(roofLine.y2).plus(moveDist).abs().toNumber()
const bStartY = Big(wallLine.y2).plus(moveDist).toNumber() const bStartY = Big(wallLine.y2).plus(moveDist).abs().toNumber()
const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 }) const inLine = findLineContainingPoint(innerLines, { y: aStartY, x: roofLine.x1 })
console.log("startLines:::::::", inLine); console.log("startLines:::::::", inLine);
const eLineY = Big(bStartY).minus(wallLine.y2).abs().toNumber() 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' }); findPoints.push({ y: aStartY, x: newPEnd.x, position: 'left_out_end' });
}else{ }else{
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber() 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 }) const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
if(inLine){ if(inLine){
if(inLine.x1 < inLine.x2) { 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' }); findPoints.push({ y: aStartY, x: newPEnd.x, position: 'right_out_start' });
}else{ }else{
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber() 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 }) const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
if(inLine){ if(inLine){
if(inLine.x2 < inLine.x1 ) { if(inLine.x2 < inLine.x1 ) {
@ -1200,7 +1200,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
newPStart.x = wallBaseLine.x1; 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 pDist = Big(wallLine.y2).minus(roofLine.y2).abs().toNumber()
const pLineX = Big(roofLine.x1).minus(0).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 } sPoint = { x: wallBaseLine.x2, y: wallBaseLine.y2 }
newPEnd.x = wallBaseLine.x2 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 pDist = Big(wallLine.y1).minus(roofLine.y1).abs().toNumber()
const pLineX = Big(roofLine.x2).minus(0).abs().toNumber() const pLineX = Big(roofLine.x2).minus(0).abs().toNumber()
@ -1245,8 +1245,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if (isStartEnd.start ) { if (isStartEnd.start ) {
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const aStartX = Big(roofLine.x1).plus(moveDist).toNumber() const aStartX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
const bStartX = Big(wallLine.x1).plus(moveDist).toNumber() const bStartX = Big(wallLine.x1).plus(moveDist).abs().toNumber()
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y }) const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
const eLineX = Big(bStartX).minus(wallLine.x1).abs().toNumber() 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' }); findPoints.push({ x: aStartX, y: newPEnd.y, position: 'top_out_start' });
}else{ }else{
const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber() 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 }) const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
if(inLine){ if(inLine){
if(inLine.y2 > inLine.y1 ) { if(inLine.y2 > inLine.y1 ) {
@ -1445,8 +1445,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if(isStartEnd.end){ if(isStartEnd.end){
const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber()
const aStartX = Big(roofLine.x2).plus(moveDist).toNumber() const aStartX = Big(roofLine.x2).plus(moveDist).abs().toNumber()
const bStartX = Big(wallLine.x2).plus(moveDist).toNumber() const bStartX = Big(wallLine.x2).plus(moveDist).abs().toNumber()
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 }) const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: roofLine.y1 })
console.log("startLines:::::::", inLine); console.log("startLines:::::::", inLine);
const eLineX = Big(bStartX).minus(wallLine.x2).abs().toNumber() 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' }); findPoints.push({ x: aStartX, y: newPEnd.y, position: 'bottom_out_end' });
}else{ }else{
const cLineX = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber() 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 }) const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
if(inLine){ if(inLine){
if(inLine.y2 < inLine.y1 ) { if(inLine.y2 < inLine.y1 ) {