out 완성변경
This commit is contained in:
parent
fe47bbee23
commit
89aa772a01
@ -855,81 +855,190 @@ if((roof.moveUpDown??0 > 0) ) {
|
||||
if (fullyMoved ) {
|
||||
//반시계방향향
|
||||
console.log("moveFully:::::::::::::", wallBaseLine, newPStart, newPEnd)
|
||||
const mLine = getSelectLinePosition(wall, wallBaseLine)
|
||||
|
||||
if (getOrientation(roofLine) === 'vertical') {
|
||||
//왼쪽 부터 roofLine, wallBaseLine
|
||||
if (['left', 'right'].includes(mLine.position)) {
|
||||
const positionType =
|
||||
(mLine.position === 'left' && wallLine.x1 < wallBaseLine.x1) ||
|
||||
(mLine.position === 'right' && wallLine.x1 > wallBaseLine.x1)
|
||||
? 'in' : 'out';
|
||||
const condition = `${mLine.position}_${positionType}`;
|
||||
|
||||
switch (condition) {
|
||||
case 'left_in':
|
||||
isIn = true
|
||||
newPEnd.y = wallBaseLine.y2;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
break;
|
||||
case 'left_out':
|
||||
const moveX = Math.abs(wallBaseLine.x1 - wallLine.x1)
|
||||
const aStartY = Math.abs(newPEnd.y + moveX)
|
||||
const bStartY = Math.abs(wallLine.y2 + moveX)
|
||||
findPoints.push({ x: newPEnd.x, y: aStartY });
|
||||
const inLine = findLineContainingPoint(innerLines, { x: newPEnd.x, y: aStartY })
|
||||
// console.log("startLines:::::::", inLine);
|
||||
getAddLine({ x: wallLine.x1, y: roofLine.y2 }, { x: wallLine.x1, y: bStartY })
|
||||
getAddLine({ x: wallLine.x2, y: bStartY }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
const eLineY = Math.abs(bStartY - wallLine.y2)
|
||||
newPStart.y += eLineY
|
||||
newPEnd.y = aStartY
|
||||
break;
|
||||
case 'right_in':
|
||||
newPEnd.y = wallBaseLine.y2;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
break;
|
||||
case 'right_out':
|
||||
const moveX1 = Math.abs(wallBaseLine.x2 - wallLine.x2)
|
||||
const aStartY1 = Math.abs(newPStart.y + moveX1)
|
||||
const bStartY1 = Math.abs(wallLine.y1 + moveX1)
|
||||
|
||||
findPoints.push({ x: newPStart.x, y: aStartY1 });
|
||||
const inLine1 = findLineContainingPoint(innerLines, { x: newPStart.x, y: aStartY1})
|
||||
console.log("startLines:::::::", inLine1);
|
||||
getAddLine({ x: wallLine.x2, y: roofLine.y1 }, {x: wallLine.x2 , y: bStartY1})
|
||||
getAddLine({ x: wallLine.x1, y: bStartY1 }, { x: inLine1.x2, y: inLine1.y2}, 'pink' )
|
||||
const eLineY1 = Math.abs( bStartY1 - wallLine.y1)
|
||||
newPEnd.y += eLineY1
|
||||
newPStart.y = aStartY1
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//왼쪽 부터 roofLine, wallBaseLine
|
||||
if (newPEnd.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPStart.y && newPStart.y <= wallBaseLine.y1) { //top right
|
||||
newPStart.y = wallBaseLine.y1;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
// newPStart.y = wallBaseLine.y1;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
// findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
} else if (wallBaseLine.y2 <= newPEnd.y && newPEnd.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPStart.y) { //bottom right
|
||||
newPEnd.y = wallBaseLine.y2;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
// newPEnd.y = wallBaseLine.y2;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
// findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
|
||||
} else if (newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) { //top left
|
||||
} else if (newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) { //in top left / out top left
|
||||
|
||||
newPEnd.y = wallBaseLine.y2;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
// if(isIn) {
|
||||
// newPEnd.y = wallBaseLine.y2;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
// findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
// }else if(isOut){
|
||||
// const moveX = Math.abs(wallBaseLine.x1 - wallLine.x1)
|
||||
// const aStartY = Math.abs(newPEnd.y + moveX)
|
||||
// const bStartY = Math.abs(wallLine.y2 + moveX)
|
||||
// //newPStart.x += moveX
|
||||
// //wallLine.x1 += moveX
|
||||
// findPoints.push({ x: newPEnd.x, y: aStartY});
|
||||
// const inLine = findLineContainingPoint(innerLines, { x: newPEnd.x, y: aStartY})
|
||||
// // console.log("startLines:::::::", inLine);
|
||||
// getAddLine({ x: wallLine.x1, y: roofLine.y2 }, {x: wallLine.x1 , y: bStartY})
|
||||
// getAddLine({ x: wallLine.x2, y: bStartY }, { x: inLine.x2, y: inLine.y2}, 'pink' )
|
||||
// const eLineY = Math.abs( bStartY - wallLine.y2)
|
||||
// newPStart.y += eLineY
|
||||
// newPEnd.y = aStartY
|
||||
// }
|
||||
|
||||
} else if (wallBaseLine.y1 <= newPStart.y && newPStart.y <= wallBaseLine.y2 && wallBaseLine.y2 <= newPEnd.y) { //bottom left
|
||||
newPStart.y = wallBaseLine.y1;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
// newPStart.y = wallBaseLine.y1;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
// findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
|
||||
|
||||
} else if (wallBaseLine.y2 <= newPEnd.y && newPEnd.y <= newPStart.y && newPStart.y <= wallBaseLine.y1) { // 위가운데
|
||||
newPEnd.y = wallBaseLine.y2;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
newPStart.y = wallBaseLine.y1;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
// newPEnd.y = wallBaseLine.y2;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
// newPStart.y = wallBaseLine.y1;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
|
||||
} else if (wallBaseLine.y1 <= newPStart.y && newPStart.y <= newPEnd.y &&newPEnd.y <= wallBaseLine.y2) { // 아래가운데
|
||||
newPEnd.y = wallBaseLine.y1;
|
||||
getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
newPStart.y = wallBaseLine.y2;
|
||||
getAddLine({ x: newPStart.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
} else if (wallBaseLine.y1 <= newPStart.y && newPStart.y <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) { // 아래가운데
|
||||
// newPEnd.y = wallBaseLine.y1;
|
||||
// getAddLine({ x: newPEnd.x, y: wallBaseLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
// newPStart.y = wallBaseLine.y2;
|
||||
// getAddLine({ x: newPStart.x, y: wallBaseLine.y2 }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
}
|
||||
|
||||
|
||||
} else if (getOrientation(roofLine) === 'horizontal') { //red
|
||||
|
||||
if(wallLine.y1 < wallBaseLine.y1 ) isIn = true
|
||||
if(wallBaseLine.y1 < wallLine.y1 ) isOut = true
|
||||
if (['top', 'bottom'].includes(mLine.position)) {
|
||||
const positionType =
|
||||
(mLine.position === 'top' && wallLine.y1 < wallBaseLine.y1) ||
|
||||
(mLine.position === 'bottom' && wallLine.y1 > wallBaseLine.y1)
|
||||
? 'in' : 'out';
|
||||
|
||||
const condition = `${mLine.position}_${positionType}`;
|
||||
|
||||
switch (condition) {
|
||||
case 'top_in':
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
//추가 수직
|
||||
getAddLine({ x: wallBaseLine.x1, y: newPEnd.y }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
//추가 라인?
|
||||
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
|
||||
break;
|
||||
case 'top_out':
|
||||
const moveY = Math.abs(wallLine.y1 - wallBaseLine.y1)
|
||||
const dist = Math.abs(roofLine.y1 - wallLine.y1)
|
||||
const aStartX = Math.abs(newPStart.x + moveY)
|
||||
const bStartX = Math.abs(wallLine.x1 + moveY)
|
||||
|
||||
//newPStart.x += moveX
|
||||
//wallLine.x1 += moveX
|
||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||
console.log("startLines:::::::", inLine);
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 })
|
||||
getAddLine({ x: bStartX, y: wallLine.y2 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
const eLineX = Math.abs(bStartX - wallLine.x1)
|
||||
newPEnd.x += eLineX
|
||||
newPStart.x = aStartX
|
||||
break;
|
||||
case 'bottom_in':
|
||||
|
||||
break;
|
||||
case 'bottom_out':
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 <= newPStart.x && newPStart.x <= wallBaseLine.x1) { //in top left //out top left
|
||||
|
||||
if(isIn){
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
//추가 수직
|
||||
getAddLine({ x: wallBaseLine.x1, y: newPEnd.y }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
//추가 라인?
|
||||
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
|
||||
}else if(isOut) {
|
||||
const moveX = Math.abs(wallLine.y1 - wallBaseLine.y1)
|
||||
const dist = Math.abs(roofLine.y1 - wallLine.y1)
|
||||
const aStartX = Math.abs(newPStart.x + moveX)
|
||||
const bStartX = Math.abs(wallLine.x1 + moveX)
|
||||
//newPStart.x += moveX
|
||||
//wallLine.x1 += moveX
|
||||
findPoints.push({ x: aStartX , y: newPEnd.y});
|
||||
const inLine = findLineContainingPoint(innerLines, { x: aStartX , y: newPEnd.y})
|
||||
console.log("startLines:::::::", inLine);
|
||||
getAddLine({ x: bStartX, y: wallLine.y1 },{ x: roofLine.x1, y: wallLine.y1 })
|
||||
getAddLine({ x: bStartX, y: wallLine.y2 }, { x: inLine.x2, y: inLine.y2 }, 'pink' )
|
||||
const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
newPEnd.x += eLineX
|
||||
newPStart.x = aStartX
|
||||
}
|
||||
|
||||
// if (isIn) {
|
||||
// newPStart.x = wallBaseLine.x1;
|
||||
// //추가 수직
|
||||
// getAddLine({ x: wallBaseLine.x1, y: newPEnd.y }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
// //추가 라인?
|
||||
// findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
//
|
||||
// } else if (isOut) {
|
||||
// const moveY = Math.abs(wallLine.y1 - wallBaseLine.y1)
|
||||
// const dist = Math.abs(roofLine.y1 - wallLine.y1)
|
||||
// const aStartX = Math.abs(newPStart.x + moveY)
|
||||
// const bStartX = Math.abs(wallLine.x1 + moveY)
|
||||
//
|
||||
// //newPStart.x += moveX
|
||||
// //wallLine.x1 += moveX
|
||||
// findPoints.push({ x: aStartX, y: newPEnd.y });
|
||||
// const inLine = findLineContainingPoint(innerLines, { x: aStartX, y: newPEnd.y })
|
||||
// console.log("startLines:::::::", inLine);
|
||||
// getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 })
|
||||
// getAddLine({ x: bStartX, y: wallLine.y2 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||
// const eLineX = Math.abs(bStartX - wallLine.x1)
|
||||
// newPEnd.x += eLineX
|
||||
// newPStart.x = aStartX
|
||||
// }
|
||||
|
||||
/*
|
||||
} else if (wallBaseLine.x2 <= newPEnd.x && newPEnd.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x) { //top right
|
||||
newPEnd.x = wallBaseLine.x2;
|
||||
//추가 수직
|
||||
getAddLine({ x: wallBaseLine.x2, y: newPEnd.y }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
//추가 라인?
|
||||
//추가 라인?
|
||||
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
|
||||
} else if (newPStart.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPEnd.x && newPEnd.x <= wallBaseLine.x2) { //bottom left
|
||||
@ -953,7 +1062,7 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
newPStart.x = wallBaseLine.x1;
|
||||
getAddLine({ x: wallBaseLine.x1, y: newPEnd.y }, { x: wallBaseLine.x1, y: wallBaseLine.y1 })
|
||||
findPoints.push({ x: wallBaseLine.x1, y: wallBaseLine.y1 });
|
||||
//추가 라인?
|
||||
//추가 라인?
|
||||
|
||||
|
||||
} else if (wallBaseLine.x1 <= newPStart.x && newPStart.x <= newPEnd.x && newPEnd.x <= wallBaseLine.x2) { // 아래가운데
|
||||
@ -963,45 +1072,47 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
newPStart.x = wallBaseLine.x2;
|
||||
getAddLine({ x: wallBaseLine.x2, y: newPEnd.y }, { x: wallBaseLine.x2, y: wallBaseLine.y2 })
|
||||
findPoints.push({ x: wallBaseLine.x2, y: wallBaseLine.y2 });
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getAddLine(newPStart, newPEnd, 'red')
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
} else if (movedStart ) { //end 변경경
|
||||
|
||||
|
||||
if (getOrientation(roofLine) === 'vertical') { //green 수직
|
||||
|
||||
if(wallLine.y1 <= wallBaseLine.y1 ) isIn = true
|
||||
if(wallBaseLine.y1 <= wallLine.y1 ) isOut = true
|
||||
const mLine = getSelectLinePosition(wall, wallBaseLine)
|
||||
if(mLine.position === 'left') isIn = true
|
||||
if(mLine.position === 'right') isOut = true
|
||||
|
||||
let isCross = false
|
||||
if (Math.abs(currentRoofLine.x2 - roofLine.x1) < 0.1 || Math.abs(currentRoofLine.x1 - roofLine.x2) < 0.1) {
|
||||
if (Math.abs(currentRoofLine?.x2 - roofLine.x1) < 0.1 || Math.abs(currentRoofLine?.x1 - roofLine.x2) < 0.1) {
|
||||
isCross = true;
|
||||
}
|
||||
|
||||
if(newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 < wallBaseLine.y2 && wallBaseLine.y2 < newPEnd.y){//in bottom left
|
||||
if(isIn){
|
||||
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 < wallBaseLine.y1 && wallBaseLine.y1 <= newPStart.y){ //하단 오른쪽v
|
||||
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) { //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 }
|
||||
|
||||
//대각선 라인을 보조라인으로 그린다.
|
||||
if(isCross){
|
||||
getAddLine({ x: wallBaseLine.x1, y: wallBaseLine.y1 }, { x: roofLine.x1, y: currentRoofLine.y1 }, 'yellow')
|
||||
getAddLine({ x: wallBaseLine.x1, y: wallBaseLine.y1 }, { x: roofLine.x1, y: currentRoofLine?.y1 }, 'yellow')
|
||||
}
|
||||
|
||||
}else if(newPStart.y <= wallBaseLine.y1 && wallBaseLine.y1 <= newPEnd.y && newPEnd.y <= wallBaseLine.y2) {//상단 오르쪽
|
||||
@ -1034,6 +1145,11 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
|
||||
} else if (getOrientation(roofLine) === 'horizontal') { //green 수평
|
||||
|
||||
|
||||
const mLine = getSelectLinePosition(wall, wallBaseLine)
|
||||
if(mLine.position === 'top') isIn = true
|
||||
if(mLine.position === 'bottom') isOut = true
|
||||
|
||||
let isCross = false
|
||||
if (Math.abs(currentRoofLine.y1 - roofLine.y2) < 0.1 || Math.abs(currentRoofLine.y2 - roofLine.y1) < 0.1) {
|
||||
isCross = true;
|
||||
@ -1042,22 +1158,32 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
newPStart = { y: roofLine.y1, x: roofLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 < wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x){ //top right
|
||||
newPStart = { y: roofLine.y1, x: roofLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
|
||||
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 <= newPStart.x && newPStart.x <= wallBaseLine.x1) { //상단 왼쪽v
|
||||
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
newPEnd ={ y: roofLine.y2, x: roofLine.x2 }
|
||||
|
||||
//대각선 라인을 보조라인으로 그린다.
|
||||
if(isCross){
|
||||
getAddLine({ x: currentRoofLine.x1, y: roofLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 }, 'yellow')
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 < wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x){ //out top left / top right
|
||||
if(isIn){
|
||||
newPStart = { y: roofLine.y1, x: roofLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
}else if(isOut){
|
||||
newPEnd = { x: roofLine.x2, y: roofLine.y2 }
|
||||
newPStart ={ x: wallLine.x1, y: roofLine.y1 }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 <= newPStart.x && newPStart.x <= wallBaseLine.x1) { //in top left
|
||||
if(isIn){
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
newPEnd ={ y: roofLine.y2, x: roofLine.x2 }
|
||||
|
||||
//대각선 라인을 보조라인으로 그린다.
|
||||
if(isCross){
|
||||
getAddLine({ x: currentRoofLine.x1, y: roofLine.y1 }, { x: wallBaseLine.x1, y: wallBaseLine.y1 }, 'yellow')
|
||||
}
|
||||
}else if(isOut){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else if(newPStart.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPEnd.x && newPEnd.x <= wallBaseLine.x2) {//상단 오르쪽
|
||||
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
@ -1088,7 +1214,7 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
|
||||
getAddLine(newPStart, newPEnd, 'green')
|
||||
//movedLines.push({ index, newPStart, newPEnd })
|
||||
console.log("moveStart:::::::::::::", origin, newPStart, newPEnd)
|
||||
//console.log("moveStart:::::::::::::", origin, newPStart, newPEnd)
|
||||
|
||||
} else if (movedEnd ) { //start변경
|
||||
|
||||
@ -1096,8 +1222,9 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
|
||||
|
||||
if (getOrientation(roofLine) === 'vertical') { //수직 오렌지
|
||||
if(wallLine.y1 <= wallBaseLine.y1 && wallLine.y2 <= wallBaseLine.y2) isIn = true
|
||||
if(wallLine.y1 <= wallBaseLine.y1 && wallBaseLine.y2 <= wallBaseLine.y2 ) isOut = true
|
||||
const mLine = getSelectLinePosition(wall, wallBaseLine)
|
||||
if(mLine.position === 'left') isIn = true
|
||||
if(mLine.position === 'right') isOut = true
|
||||
|
||||
let isCross = false
|
||||
if (Math.abs(currentRoofLine.x2 - roofLine.x1) < 0.1 || Math.abs(currentRoofLine.x1 - roofLine.x2) < 0.1) {
|
||||
@ -1161,7 +1288,11 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
|
||||
|
||||
|
||||
} else if (getOrientation(roofLine) === 'horizontal') {
|
||||
} else if (getOrientation(roofLine) === 'horizontal') { //오렌지
|
||||
|
||||
const mLine = getSelectLinePosition(wall, wallBaseLine)
|
||||
if(mLine.position === 'top') isIn = true
|
||||
if(mLine.position === 'bottom') isOut = true
|
||||
|
||||
let isCross = false
|
||||
if (Math.abs(currentRoofLine.y2 - roofLine.y1) < 0.1 || Math.abs(currentRoofLine.y1 - roofLine.y2) < 0.1) {
|
||||
@ -1172,9 +1303,13 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x2 : wallBaseLine.x2 }
|
||||
newPEnd = { y: roofLine.y2, x: roofLine.x2 }
|
||||
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 < wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x){ //left / top
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x2 : wallBaseLine.x2 }
|
||||
newPEnd = { y: roofLine.y2, x: roofLine.x2 }
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 < wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x){ //in top left
|
||||
|
||||
if(isIn){
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x2 : wallBaseLine.x2 }
|
||||
newPEnd = { y: roofLine.y2, x: roofLine.x2 }
|
||||
}
|
||||
|
||||
|
||||
}else if(newPEnd.x <= wallBaseLine.x2 && wallBaseLine.x2 <= newPStart.x && newPStart.x <= wallBaseLine.x1) { //left top
|
||||
|
||||
@ -1197,16 +1332,22 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
newPStart = { y: roofLine.y1, x: (isCross) ? currentRoofLine.x1 : wallBaseLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: roofLine.x2 }
|
||||
|
||||
}else if (wallBaseLine.x2 <= newPEnd.x && newPEnd.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x) { //하단 왼쪽
|
||||
}else if (wallBaseLine.x2 <= newPEnd.x && newPEnd.x <= wallBaseLine.x1 && wallBaseLine.x1 <= newPStart.x) { //out top left
|
||||
|
||||
newPStart = { y: roofLine.y1, x: roofLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: (isCross) ? currentRoofLine.x2 : wallBaseLine.x2 }
|
||||
|
||||
//대각선 라인을 보조라인으로 그린다.
|
||||
if(isCross){
|
||||
getAddLine({ x: currentRoofLine.x2, y: roofLine.y2 }, { x:wallBaseLine.x2 , y: wallBaseLine.y2 }, 'yellow')
|
||||
if(isIn){
|
||||
newPStart = { y: roofLine.y1, x: roofLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: (isCross) ? currentRoofLine.x2 : wallBaseLine.x2 }
|
||||
//대각선 라인을 보조라인으로 그린다.
|
||||
if(isCross){
|
||||
getAddLine({ x: currentRoofLine.x2, y: roofLine.y2 }, { x:wallBaseLine.x2 , y: wallBaseLine.y2 }, 'yellow')
|
||||
}
|
||||
}else if(isOut){
|
||||
// newPEnd = { x: roofLine.x2, y: roofLine.y2 }
|
||||
// newPStart = { x: wallLine.x2, y: roofLine.y2 }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else if (wallBaseLine.x2 <= newPEnd.x && newPEnd.x <= newPStart.x && newPStart.x <= wallBaseLine.x1){ //top center
|
||||
newPStart = { y: roofLine.y1, x: roofLine.x1 }
|
||||
newPEnd = { y: roofLine.y2, x: (isCross) ? currentRoofLine.x2 : wallBaseLine.x2 }
|
||||
@ -1216,11 +1357,11 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
// newPEnd = { x: (isCross) ? currentRoofLine.x2 : origin.x2, y: roofLine.y2 } //수직라인 접점까지지
|
||||
|
||||
}
|
||||
console.log("movedEnd:::::::::::::", origin, newPStart, newPEnd)
|
||||
//console.log("movedEnd:::::::::::::", origin, newPStart, newPEnd)
|
||||
getAddLine(newPStart, newPEnd, 'orange')
|
||||
//movedLines.push({ index, newPStart, newPEnd })
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
canvas.renderAll()
|
||||
|
||||
@ -1228,8 +1369,8 @@ const eLineX = Math.abs( bStartX - wallLine.x1)
|
||||
});
|
||||
|
||||
//polygon 만들기
|
||||
console.log("innerLines:::::", innerLines)
|
||||
console.log("movedLines", movedLines)
|
||||
//console.log("innerLines:::::", innerLines)
|
||||
//console.log("movedLines", movedLines)
|
||||
// console.log("updateLines:::::", updateLines)
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user