4, 6만 QPolygon화 가능

This commit is contained in:
hyojun.choi 2024-07-16 17:16:41 +09:00
parent 15c872e715
commit 4f057473cd

View File

@ -21,7 +21,12 @@ export default class QPolygon extends fabric.Group {
qCells = [] qCells = []
name name
shape = 0 // 점 6개일때의 shape 모양 shape = 0 // 점 6개일때의 shape 모양
helpPoints = []
helpLines = []
constructor(points, options, canvas) { constructor(points, options, canvas) {
if (points.length !== 4 || points.length !== 6) {
throw new Error('Points must be 4 or 6.')
}
if (!options.fontSize) { if (!options.fontSize) {
throw new Error('Font size is required.') throw new Error('Font size is required.')
} }
@ -735,7 +740,17 @@ export default class QPolygon extends fabric.Group {
}, },
Math.abs(realLine1.length - realLine3.length), Math.abs(realLine1.length - realLine3.length),
) )
this.helpLines = [
realLine1,
realLine2,
realLine3,
realLine4,
realLine5,
realLine6,
ridge1,
ridge2,
ridgeEndLine,
]
this.addWithUpdate(realLine1) this.addWithUpdate(realLine1)
this.addWithUpdate(realLine2) this.addWithUpdate(realLine2)
this.addWithUpdate(realLine3) this.addWithUpdate(realLine3)