QPolygon 수정

This commit is contained in:
hyojun.choi 2024-07-31 10:55:36 +09:00
parent 71494d0369
commit 76d9a046a4

View File

@ -2,7 +2,7 @@ import { fabric } from 'fabric'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { QLine } from '@/components/fabric/QLine' import { QLine } from '@/components/fabric/QLine'
import { distanceBetweenPoints, findTopTwoIndexesByDistance, getDirectionByPoint, sortedPointLessEightPoint, sortedPoints } from '@/util/canvas-util' import { distanceBetweenPoints, findTopTwoIndexesByDistance, getDirectionByPoint, sortedPointLessEightPoint, sortedPoints } from '@/util/canvas-util'
import { drawHelpLineInHexagon2 } from '@/util/qpolygon-utils' import { drawHelpLineInHexagon } from '@/util/qpolygon-utils'
export const QPolygon = fabric.util.createClass(fabric.Polygon, { export const QPolygon = fabric.util.createClass(fabric.Polygon, {
type: 'QPolygon', type: 'QPolygon',
@ -10,6 +10,9 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
texts: [], texts: [],
id: null, id: null,
length: 0, length: 0,
hips: [],
ridges: [],
connectRidges: [],
initialize: function (points, options, canvas) { initialize: function (points, options, canvas) {
// 소수점 전부 제거 // 소수점 전부 제거
points.forEach((point) => { points.forEach((point) => {
@ -122,7 +125,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
// 보조선 그리기 // 보조선 그리기
drawHelpLine(chon = 4) { drawHelpLine(chon = 4) {
drawHelpLineInHexagon2(this, chon) drawHelpLineInHexagon(this, chon)
}, },
addLengthText() { addLengthText() {
@ -313,4 +316,5 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
text.set({ visible: isView }) text.set({ visible: isView })
}) })
}, },
divideLine() {},
}) })