6각형 polygon make 테스트
This commit is contained in:
parent
9e075deb91
commit
e5de66bc94
@ -1,13 +1,7 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import QRect from '@/components/fabric/QRect'
|
||||
import QPolygon from '@/components/fabric/QPolygon'
|
||||
import {
|
||||
findTopTwoIndexesByDistance,
|
||||
getCenterPoint,
|
||||
getDirection,
|
||||
getStartIndex,
|
||||
rearrangeArray,
|
||||
} from '@/util/canvas-util'
|
||||
import { findTopTwoIndexesByDistance, getCenterPoint, getDirection, getStartIndex, rearrangeArray } from '@/util/canvas-util'
|
||||
import { useRecoilState } from 'recoil'
|
||||
import { fontSizeState, roofState, sortedPolygonArray, templatePolygonArrayState, wallState } from '@/store/canvasAtom'
|
||||
import { QLine } from '@/components/fabric/QLine'
|
||||
@ -1171,7 +1165,6 @@ export function useMode() {
|
||||
)
|
||||
canvas.add(horiCenterLine2)
|
||||
|
||||
|
||||
//작은 지붕쪽 높이 길이를 구하는 로직
|
||||
let secondVertCenterPoint = (lastLine.x1 + lastLine.x2) / 2
|
||||
secondVertCenterLine = new QLine([secondVertCenterPoint, middleSubLine.y1, secondVertCenterPoint, middleSubLine.y2 - edge], centerLineOpt)
|
||||
@ -1257,11 +1250,31 @@ export function useMode() {
|
||||
canvas.add(drawLastInLine2)
|
||||
outLines.push(drawLastInLine2)
|
||||
|
||||
const bigPolygon = [
|
||||
{ x1: outLines[2].x1, y1: outLines[2].y1 },
|
||||
console.log('outLines', outLines)
|
||||
|
||||
const bigPolygonArray = [
|
||||
{ x: outLines[2].x1, y: outLines[2].y1 },
|
||||
{ x: outLines[5].x1, y: outLines[5].y1 },
|
||||
{ x: outLines[0].x1, y: outLines[0].y1 },
|
||||
{ x: outLines[0].x2, y: outLines[0].y2 },
|
||||
{ x: outLines[11].x1, y: outLines[11].y1 },
|
||||
{ x: outLines[1].x2, y: outLines[1].y2 },
|
||||
]
|
||||
|
||||
// 점 배열을 사용하여 새로운 다각형 객체를 생성합니다.
|
||||
const bigPolygon = new QPolygon(
|
||||
bigPolygonArray,
|
||||
{
|
||||
stroke: 'black',
|
||||
fill: 'red',
|
||||
viewLengthText: true,
|
||||
selectable: true,
|
||||
fontSize: fontSize,
|
||||
},
|
||||
canvas,
|
||||
)
|
||||
|
||||
canvas.add(bigPolygon)
|
||||
} else {
|
||||
//아래쪽 길게 오른쪽 방향
|
||||
//배열 순서대로 뒤에꺼를 찾아서 계산한다
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user