Merge branch 'dev' into dev-yj
This commit is contained in:
commit
3c7ad140d7
@ -24,7 +24,7 @@ import { calculateAngle, isSamePoint } from '@/util/qpolygon-utils'
|
|||||||
import { POLYGON_TYPE } from '@/common/common'
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
|
|
||||||
// 보조선 작성
|
// 보조선 작성
|
||||||
export function useAuxiliaryDrawing(id) {
|
export function useAuxiliaryDrawing(id, isUseEffect = true) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { addCanvasMouseEventListener, addDocumentEventListener, removeMouseLine, initEvent } = useEvent()
|
const { addCanvasMouseEventListener, addDocumentEventListener, removeMouseLine, initEvent } = useEvent()
|
||||||
// const { addCanvasMouseEventListener, addDocumentEventListener, removeMouseLine, initEvent } = useContext(EventContext)
|
// const { addCanvasMouseEventListener, addDocumentEventListener, removeMouseLine, initEvent } = useContext(EventContext)
|
||||||
@ -654,6 +654,8 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
selectable: true,
|
selectable: true,
|
||||||
name: 'auxiliaryLine',
|
name: 'auxiliaryLine',
|
||||||
isFixed: true,
|
isFixed: true,
|
||||||
|
attributes: { ...line1.attributes },
|
||||||
|
parentId: line1.parentId,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
lineHistory.current.push(newLine)
|
lineHistory.current.push(newLine)
|
||||||
@ -674,6 +676,8 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
selectable: false,
|
selectable: false,
|
||||||
name: 'auxiliaryLine',
|
name: 'auxiliaryLine',
|
||||||
isFixed: true,
|
isFixed: true,
|
||||||
|
attributes: { ...line1.attributes },
|
||||||
|
parentId: line1.parentId,
|
||||||
})
|
})
|
||||||
lineHistory.current.push(newLine)
|
lineHistory.current.push(newLine)
|
||||||
lineHistory.current = lineHistory.current.filter((history) => history !== line1)
|
lineHistory.current = lineHistory.current.filter((history) => history !== line1)
|
||||||
@ -685,6 +689,8 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
selectable: false,
|
selectable: false,
|
||||||
name: 'auxiliaryLine',
|
name: 'auxiliaryLine',
|
||||||
isFixed: true,
|
isFixed: true,
|
||||||
|
attributes: { ...line1.attributes },
|
||||||
|
parentId: line1.parentId,
|
||||||
})
|
})
|
||||||
lineHistory.current.push(newLine)
|
lineHistory.current.push(newLine)
|
||||||
lineHistory.current = lineHistory.current.filter((history) => history !== line1)
|
lineHistory.current = lineHistory.current.filter((history) => history !== line1)
|
||||||
@ -724,6 +730,8 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
selectable: true,
|
selectable: true,
|
||||||
name: 'auxiliaryLine',
|
name: 'auxiliaryLine',
|
||||||
isFixed: true,
|
isFixed: true,
|
||||||
|
attributes: { ...line1.attributes },
|
||||||
|
parentId: line1.parentId,
|
||||||
intersectionPoint,
|
intersectionPoint,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -733,6 +741,8 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
selectable: true,
|
selectable: true,
|
||||||
name: 'auxiliaryLine',
|
name: 'auxiliaryLine',
|
||||||
isFixed: true,
|
isFixed: true,
|
||||||
|
attributes: { ...line1.attributes },
|
||||||
|
parentId: line1.parentId,
|
||||||
intersectionPoint,
|
intersectionPoint,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -825,7 +835,7 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
|
|
||||||
//lineHistory.current에 있는 선들 중 startPoint와 endPoint가 겹치는 line은 제거
|
//lineHistory.current에 있는 선들 중 startPoint와 endPoint가 겹치는 line은 제거
|
||||||
// 겹치는 선 하나는 canvas에서 제거한다.
|
// 겹치는 선 하나는 canvas에서 제거한다.
|
||||||
const tempLines = [...lineHistory.current]
|
const tempLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine' && !obj.isAuxiliaryFixed)
|
||||||
lineHistory.current = []
|
lineHistory.current = []
|
||||||
tempLines.forEach((line) => {
|
tempLines.forEach((line) => {
|
||||||
if (
|
if (
|
||||||
@ -842,7 +852,7 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
lineHistory.current.push(line)
|
lineHistory.current.push(line)
|
||||||
})
|
})
|
||||||
|
|
||||||
const innerLines = lineHistory.current
|
const innerLines = lineHistory.current.filter((line) => line.name === 'auxiliaryLine' && line.visible)
|
||||||
|
|
||||||
roofBases.forEach((roofBase) => {
|
roofBases.forEach((roofBase) => {
|
||||||
const tempPolygonPoints = [...roofBase.points].map((obj) => {
|
const tempPolygonPoints = [...roofBase.points].map((obj) => {
|
||||||
@ -865,6 +875,7 @@ export function useAuxiliaryDrawing(id) {
|
|||||||
actualSize: line.attributes?.actualSize ?? 0,
|
actualSize: line.attributes?.actualSize ?? 0,
|
||||||
planeSize: line.getLength(),
|
planeSize: line.getLength(),
|
||||||
}
|
}
|
||||||
|
line.isAuxiliaryFixed = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -180,6 +180,12 @@ export function useContextMenu() {
|
|||||||
fn: () => {
|
fn: () => {
|
||||||
if (!currentObject) return
|
if (!currentObject) return
|
||||||
const roof = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]
|
const roof = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]
|
||||||
|
if (!roof) {
|
||||||
|
// 아직 innerLines로 세팅이 안되어있는 line인 경우 제거
|
||||||
|
canvas.remove(currentObject)
|
||||||
|
canvas.discardActiveObject()
|
||||||
|
return
|
||||||
|
}
|
||||||
const innerLines = roof.innerLines?.filter((line) => currentObject.id !== line.id)
|
const innerLines = roof.innerLines?.filter((line) => currentObject.id !== line.id)
|
||||||
roof.innerLines = [...innerLines]
|
roof.innerLines = [...innerLines]
|
||||||
canvas.remove(currentObject)
|
canvas.remove(currentObject)
|
||||||
@ -221,6 +227,11 @@ export function useContextMenu() {
|
|||||||
name: 'auxiliaryLine',
|
name: 'auxiliaryLine',
|
||||||
attributes: { ...currentObject.attributes },
|
attributes: { ...currentObject.attributes },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!currentObject.attributes.roofId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
canvas
|
canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
.filter((obj) => obj.id === currentObject.attributes.roofId)[0]
|
.filter((obj) => obj.id === currentObject.attributes.roofId)[0]
|
||||||
@ -235,11 +246,21 @@ export function useContextMenu() {
|
|||||||
swalFire({ text: '지붕을 선택해주세요.' })
|
swalFire({ text: '지붕을 선택해주세요.' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const innerLines = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0].innerLines
|
const innerLines = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]?.innerLines
|
||||||
innerLines.forEach((line) => {
|
if (innerLines) {
|
||||||
|
innerLines.forEach((line) => {
|
||||||
|
canvas.remove(line)
|
||||||
|
})
|
||||||
|
innerLines.length = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// 확정되지 않은 보조선
|
||||||
|
const notFixedAuxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine' && !obj.isAuxiliaryFixed)
|
||||||
|
|
||||||
|
notFixedAuxiliaryLines.forEach((line) => {
|
||||||
canvas.remove(line)
|
canvas.remove(line)
|
||||||
})
|
})
|
||||||
innerLines.length = 0
|
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { atom } from 'recoil'
|
|||||||
|
|
||||||
export const globalLocaleStore = atom({
|
export const globalLocaleStore = atom({
|
||||||
key: 'globalLocaleState',
|
key: 'globalLocaleState',
|
||||||
default: 'ko',
|
default: 'ja',
|
||||||
})
|
})
|
||||||
|
|
||||||
export const appMessageStore = atom({
|
export const appMessageStore = atom({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user