From 15c872e715e444435c36ad41cfda932b7792880c Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Tue, 16 Jul 2024 17:13:27 +0900 Subject: [PATCH] =?UTF-8?q?canvas=20=EC=97=86=EC=96=B4=EB=8F=84=20?= =?UTF-8?q?=EB=90=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/fabric/QPolygon.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index a2a78fda..a499032f 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -25,9 +25,6 @@ export default class QPolygon extends fabric.Group { if (!options.fontSize) { throw new Error('Font size is required.') } - if (!canvas) { - throw new Error('Canvas is required.') - } const sortPoints = sortedPoints(points) const polygon = new fabric.Polygon(sortPoints, options) @@ -647,25 +644,25 @@ export default class QPolygon extends fabric.Group { const realLine1 = new QLine( [lines[0].x1, lines[0].y1, vPoint1.x, vPoint1.y], - { fontSize: this.fontSize, stroke: 'black', strokeWidth: 1 }, + { fontSize: this.fontSize, stroke: 'blue', strokeWidth: 1 }, getRoofHypotenuse(lines[0].length / 2), ) const realLine2 = new QLine( [lines[0].x2, lines[0].y2, vPoint1.x, vPoint1.y], - { fontSize: this.fontSize, stroke: 'black', strokeWidth: 1 }, + { fontSize: this.fontSize, stroke: 'blue', strokeWidth: 1 }, getRoofHypotenuse(lines[0].length / 2), ) const realLine3 = new QLine( [lines[1].x1, lines[1].y1, vPoint2.x, vPoint2.y], - { fontSize: this.fontSize, stroke: 'black', strokeWidth: 1 }, + { fontSize: this.fontSize, stroke: 'blue', strokeWidth: 1 }, getRoofHypotenuse(lines[1].length / 2), ) const realLine4 = new QLine( [lines[1].x2, lines[1].y2, vPoint2.x, vPoint2.y], - { fontSize: this.fontSize, stroke: 'black', strokeWidth: 1 }, + { fontSize: this.fontSize, stroke: 'blue', strokeWidth: 1 }, getRoofHypotenuse(lines[1].length / 2), ) @@ -674,7 +671,7 @@ export default class QPolygon extends fabric.Group { [vPoint1.x, vPoint1.y, centerPoint1.x, centerPoint1.y], { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, strokeDashArray: [5, 5], }, @@ -686,7 +683,7 @@ export default class QPolygon extends fabric.Group { [vPoint2.x, vPoint2.y, centerPoint2.x, centerPoint2.y], { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, strokeDashArray: [5, 5], }, @@ -698,7 +695,7 @@ export default class QPolygon extends fabric.Group { [lines2[0].x2, lines2[0].y2, ridgePoint1[2], ridgePoint1[3]], { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, }, getRoofHypotenuse(lines[0].length / 2), @@ -709,7 +706,7 @@ export default class QPolygon extends fabric.Group { [lines2[1].x2, lines2[1].y2, ridgePoint2[2], ridgePoint2[3]], { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, }, getRoofHypotenuse(lines[1].length / 2), @@ -718,14 +715,14 @@ export default class QPolygon extends fabric.Group { // 용마루 const ridge1 = new QLine(ridgePoint1, { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, }) // 용마루 const ridge2 = new QLine(ridgePoint2, { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, }) @@ -733,7 +730,7 @@ export default class QPolygon extends fabric.Group { [ridgePoint1[2], ridgePoint1[3], ridgePoint2[2], ridgePoint2[3]], { fontSize: this.fontSize, - stroke: 'black', + stroke: 'blue', strokeWidth: 1, }, Math.abs(realLine1.length - realLine3.length),