diff --git a/src/components/Roof2.jsx b/src/components/Roof2.jsx index 0fb89925..250be865 100644 --- a/src/components/Roof2.jsx +++ b/src/components/Roof2.jsx @@ -239,7 +239,7 @@ export default function Roof2() { ] if (canvas) { - const polygon = new QPolygon(eightPoint4, { + const polygon = new QPolygon(type1A, { // const polygon = new QPolygon(eightPoint, { fill: 'transparent', stroke: 'black', diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index 0e355a56..17a953e2 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -914,8 +914,8 @@ export default class QPolygon extends fabric.Group { #drawHelpLineInOctagon(chon) { this.drawRoofRidge() - this.drawHips() - this.connectLinePoint() + // this.drawHips() + // this.connectLinePoint() } /*마루 그리기 @@ -953,15 +953,16 @@ export default class QPolygon extends fabric.Group { nextWall = this.wall.lines[index + 1] } - if (this.getLineDirection(prevLine) !== this.getLineDirection(nextLine) && currentWall.length < currentLine.length) { - dVector = this.getDirectionForDegree(prevLine, currentLine) + // if (this.getLineDirection(prevLine) !== this.getLineDirection(nextLine) && currentWall.length < currentLine.length) { + if (this.getLineDirection(prevWall) !== this.getLineDirection(nextWall) && currentWall.length < currentLine.length) { + dVector = this.getDirectionForDegree(prevWall, currentWall) let { minLineLength, currentLineLength, maxLineLength, - } = this.getRoofBaseLine(prevLine, currentLine, nextLine, dVector) + } = this.getRoofBaseLine(prevWall, currentWall, nextWall, dVector) - console.log('currentLine.length : ' + currentLine.length) + console.log('currentLine.length : ' + currentWall.length) // 마루는 세개의 벽중에서 가장 길 수 없다. console.log('currentLineLength : ', currentLineLength, 'minLineLength : ', minLineLength, 'maxLineLength : ', maxLineLength) console.log('minLineLength <= currentLineLength <= maxLineLength', (minLineLength <= currentLineLength && currentLineLength <= maxLineLength)) @@ -974,26 +975,26 @@ export default class QPolygon extends fabric.Group { // console.log(ridgeRun) switch (dVector) { case 45: - startXPoint = currentLine.x1 + (currentLineLength / 2) - startYPoint = currentLine.y1 - (currentLineLength / 2) + startXPoint = currentWall.x1 + (currentLineLength / 2) + startYPoint = currentWall.y1 - (currentLineLength / 2) endXPoint = startXPoint endYPoint = startYPoint - ridgeRun break case 135: - startXPoint = currentLine.x1 + (currentLineLength / 2) - startYPoint = currentLine.y1 + (currentLineLength / 2) + startXPoint = currentWall.x1 + (currentLineLength / 2) + startYPoint = currentWall.y1 + (currentLineLength / 2) endXPoint = startXPoint + ridgeRun endYPoint = startYPoint break case 225: - startXPoint = currentLine.x1 - (currentLineLength / 2) - startYPoint = currentLine.y1 + (currentLineLength / 2) + startXPoint = currentWall.x1 - (currentLineLength / 2) + startYPoint = currentWall.y1 + (currentLineLength / 2) endXPoint = startXPoint endYPoint = startYPoint + ridgeRun break case 315: - startXPoint = currentLine.x1 - (currentLineLength / 2) - startYPoint = currentLine.y1 - (currentLineLength / 2) + startXPoint = currentWall.x1 - (currentLineLength / 2) + startYPoint = currentWall.y1 - (currentLineLength / 2) endXPoint = startXPoint - ridgeRun endYPoint = startYPoint break @@ -1819,9 +1820,7 @@ export default class QPolygon extends fabric.Group { 최대 생성 마루 갯수 */ getMaxRidge(length) { - let a1 = 4 - let d = 2 - return ((length - a1) / d) + 1 + return ((length - 4) / 2) + 1 } /*