가대 설치 추가
This commit is contained in:
parent
e3ac278379
commit
14a4bfa0d9
@ -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 { drawHelpLineInHexagon, drawHelpLineInHexagon2, drawHelpLineInHexagon3 } from '@/util/qpolygon-utils'
|
import { drawHelpLineInHexagon2 } from '@/util/qpolygon-utils'
|
||||||
|
|
||||||
export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||||
type: 'QPolygon',
|
type: 'QPolygon',
|
||||||
@ -212,9 +212,9 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
|||||||
top: rectTop,
|
top: rectTop,
|
||||||
width: rectWidth,
|
width: rectWidth,
|
||||||
height: rectHeight,
|
height: rectHeight,
|
||||||
stroke: 'black', // or any other color
|
fill: '#BFFD9F',
|
||||||
fill: 'transparent',
|
|
||||||
selectable: false,
|
selectable: false,
|
||||||
|
opacity: 0.6,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.canvas.add(rect)
|
this.canvas.add(rect)
|
||||||
|
|||||||
@ -6,12 +6,12 @@ import { useRecoilState } from 'recoil'
|
|||||||
import {
|
import {
|
||||||
canvasSizeState,
|
canvasSizeState,
|
||||||
fontSizeState,
|
fontSizeState,
|
||||||
|
roofPolygonArrayState,
|
||||||
roofPolygonPatternArrayState,
|
roofPolygonPatternArrayState,
|
||||||
roofState,
|
roofState,
|
||||||
sortedPolygonArray,
|
sortedPolygonArray,
|
||||||
wallState,
|
|
||||||
templateTypeState,
|
templateTypeState,
|
||||||
roofPolygonArrayState,
|
wallState,
|
||||||
} from '@/store/canvasAtom'
|
} from '@/store/canvasAtom'
|
||||||
import { QLine } from '@/components/fabric/QLine'
|
import { QLine } from '@/components/fabric/QLine'
|
||||||
import { fabric } from 'fabric'
|
import { fabric } from 'fabric'
|
||||||
@ -2267,7 +2267,13 @@ export function useMode() {
|
|||||||
canvas.add(centerLine2)
|
canvas.add(centerLine2)
|
||||||
canvas.remove(outLines[idx]) //기존 라인 삭제
|
canvas.remove(outLines[idx]) //기존 라인 삭제
|
||||||
|
|
||||||
halfHoriCenterLinePoint.push({ index: idx, x1: centerLine1.x1, y1: centerLine1.y1, x2: centerLine1.x2, y2: centerLine1.y2 }) //각 카라바 라인의 1번이 마지막점을 잡아서 센터선으로 설정
|
halfHoriCenterLinePoint.push({
|
||||||
|
index: idx,
|
||||||
|
x1: centerLine1.x1,
|
||||||
|
y1: centerLine1.y1,
|
||||||
|
x2: centerLine1.x2,
|
||||||
|
y2: centerLine1.y2,
|
||||||
|
}) //각 카라바 라인의 1번이 마지막점을 잡아서 센터선으로 설정
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -2468,7 +2474,13 @@ export function useMode() {
|
|||||||
canvas.add(centerLine2)
|
canvas.add(centerLine2)
|
||||||
canvas.remove(outline) //기존 라인 삭제
|
canvas.remove(outline) //기존 라인 삭제
|
||||||
|
|
||||||
halfHoriCenterLinePoint.push({ index: index, x1: centerLine1.x1, y1: centerLine1.y1, x2: centerLine1.x2, y2: centerLine1.y2 }) //각 카라바 라인의 1번이 마지막점을 잡아서 센터선으로 설정
|
halfHoriCenterLinePoint.push({
|
||||||
|
index: index,
|
||||||
|
x1: centerLine1.x1,
|
||||||
|
y1: centerLine1.y1,
|
||||||
|
x2: centerLine1.x2,
|
||||||
|
y2: centerLine1.y2,
|
||||||
|
}) //각 카라바 라인의 1번이 마지막점을 잡아서 센터선으로 설정
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -3211,9 +3223,8 @@ export function useMode() {
|
|||||||
|
|
||||||
roofPolygonPattern.roofPatternPolygonArray.forEach((patternPolygon, index) => {
|
roofPolygonPattern.roofPatternPolygonArray.forEach((patternPolygon, index) => {
|
||||||
const drawPolygon = new QPolygon(patternPolygon, commonOption)
|
const drawPolygon = new QPolygon(patternPolygon, commonOption)
|
||||||
drawPolygon.setViewLengthText(false)
|
|
||||||
drawPolygon.sendToBack()
|
|
||||||
canvas.add(drawPolygon)
|
canvas.add(drawPolygon)
|
||||||
|
drawPolygon.setViewLengthText(false)
|
||||||
polygonArray.push(drawPolygon)
|
polygonArray.push(drawPolygon)
|
||||||
})
|
})
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
@ -3227,11 +3238,14 @@ export function useMode() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 오목한 부분 인덱스 찾기
|
||||||
const polygons = roofPolygonArray
|
const polygons = roofPolygonArray
|
||||||
|
let concavePolygonObj = []
|
||||||
|
|
||||||
polygons.forEach((polygon) => {
|
polygons.forEach((polygon, index) => {
|
||||||
const trestlePolygon = handleOuterlinesTest(polygon, -12)
|
const trestlePolygon = handleOuterlinesTest(polygon, -12)
|
||||||
trestlePolygon.set('stroke', 'red').set('strokeDashArray', [9, 5]).set('strokeWidth', 0.3).setViewLengthText(false)
|
trestlePolygon.set('stroke', 'red').set('strokeDashArray', [9, 5]).set('strokeWidth', 0.3).setViewLengthText(false)
|
||||||
|
trestlePolygon.fillCell({ width: 100, height: 30, padding: 10 })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3247,5 +3261,6 @@ export function useMode() {
|
|||||||
handleOuterlinesTest,
|
handleOuterlinesTest,
|
||||||
handleOuterlinesTest2,
|
handleOuterlinesTest2,
|
||||||
makeRoofPatternPolygon,
|
makeRoofPatternPolygon,
|
||||||
|
makeRoofTrestle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user