Merge branch 'feature/test' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into feature/test

This commit is contained in:
yoosangwook 2024-07-17 10:57:27 +09:00
commit 9eeceeb7b0

View File

@ -21,13 +21,15 @@ export default class QPolygon extends fabric.Group {
qCells = []
name
shape = 0 // 점 6개일때의 shape 모양
helpPoints = []
helpLines = []
constructor(points, options, canvas) {
if (points.length !== 4 && points.length !== 6) {
throw new Error('Points must be 4 or 6.')
}
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 +649,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 +676,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 +688,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 +700,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 +711,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 +720,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,12 +735,22 @@ 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),
)
this.helpLines = [
realLine1,
realLine2,
realLine3,
realLine4,
realLine5,
realLine6,
ridge1,
ridge2,
ridgeEndLine,
]
this.addWithUpdate(realLine1)
this.addWithUpdate(realLine2)
this.addWithUpdate(realLine3)