context 오류 수정
This commit is contained in:
parent
38754db30d
commit
ad1898c289
@ -12,7 +12,7 @@ export default function QContextMenu(props) {
|
|||||||
let contextType = ''
|
let contextType = ''
|
||||||
|
|
||||||
if (activeObject) {
|
if (activeObject) {
|
||||||
if (activeObject.initOptions) {
|
if (activeObject.initOptions && activeObject.initOptions.name) {
|
||||||
//이건 바뀔 가능성이 있음
|
//이건 바뀔 가능성이 있음
|
||||||
if (activeObject.initOptions.name.indexOf('guide') > -1) {
|
if (activeObject.initOptions.name.indexOf('guide') > -1) {
|
||||||
contextType = 'surface' //면형상
|
contextType = 'surface' //면형상
|
||||||
|
|||||||
@ -1213,13 +1213,44 @@ export function useMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const templateSideMode = () => {
|
const templateSideMode = () => {
|
||||||
changeMode(canvas, Mode.EDIT)
|
|
||||||
|
|
||||||
if (historyPoints.current.length >= 4) {
|
if (historyPoints.current.length >= 4) {
|
||||||
const wall = drawWallPolygon()
|
const firstPoint = historyPoints.current[0]
|
||||||
setWall(wall)
|
const lastPoint = historyPoints.current[historyPoints.current.length - 1]
|
||||||
|
historyPoints.current.forEach((point) => {
|
||||||
|
canvas?.remove(point)
|
||||||
|
})
|
||||||
|
drawLineWithLength(lastPoint, firstPoint)
|
||||||
|
|
||||||
console.log('sideWall', wall)
|
// 캔버스에서 모든 라인 객체를 찾습니다.
|
||||||
|
const lines = historyLines.current
|
||||||
|
historyLines.current = []
|
||||||
|
|
||||||
|
// 각 라인의 시작점과 끝점을 사용하여 다각형의 점 배열을 생성합니다.
|
||||||
|
const points = lines.map((line) => ({ x: line.x1, y: line.y1 }))
|
||||||
|
|
||||||
|
// 모든 라인 객체를 캔버스에서 제거합니다.
|
||||||
|
lines.forEach((line) => {
|
||||||
|
canvas?.remove(line)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 점 배열을 사용하여 새로운 다각형 객체를 생성합니다.
|
||||||
|
const polygon = new QPolygon(
|
||||||
|
points,
|
||||||
|
{
|
||||||
|
stroke: 'black',
|
||||||
|
fill: 'transparent',
|
||||||
|
viewLengthText: true,
|
||||||
|
fontSize: 15,
|
||||||
|
selectable: true,
|
||||||
|
},
|
||||||
|
canvas,
|
||||||
|
)
|
||||||
|
|
||||||
|
// 새로운 다각형 객체를 캔버스에 추가합니다.
|
||||||
|
canvas.add(polygon)
|
||||||
|
|
||||||
|
changeMode(canvas, Mode.DEFAULT)
|
||||||
|
return polygon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user