디스플레이 설정 - 치수표시 추가
This commit is contained in:
parent
de95bc7c61
commit
fd9b723523
@ -790,7 +790,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
setViewLengthText(isView) {
|
||||
this.canvas
|
||||
?.getObjects()
|
||||
.filter((obj) => obj.name === 'lengthText' && obj.parent === this)
|
||||
.filter((obj) => obj.name === 'lengthText' && obj.parentId === this.id)
|
||||
.forEach((text) => {
|
||||
text.set({ visible: isView })
|
||||
})
|
||||
@ -803,9 +803,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
this.scaleY = scale
|
||||
this.addLengthText()
|
||||
},
|
||||
divideLine() {
|
||||
// splitPolygonWithLines(this)
|
||||
},
|
||||
|
||||
calcOriginCoords() {
|
||||
const points = this.points
|
||||
const minX = Math.min(...points.map((p) => p.x))
|
||||
|
||||
@ -5,7 +5,7 @@ import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
import { settingModalFirstOptionsState, settingModalSecondOptionsState } from '@/store/settingAtom'
|
||||
import { corridorDimensionSelector, settingModalFirstOptionsState, settingModalSecondOptionsState } from '@/store/settingAtom'
|
||||
import { setSurfaceShapePattern } from '@/util/canvas-util'
|
||||
import { POLYGON_TYPE } from '@/common/common'
|
||||
|
||||
@ -17,6 +17,8 @@ export function useCanvasSetting() {
|
||||
const { option1, option2, dimensionDisplay } = settingModalFirstOptions
|
||||
const { option3, option4 } = settingModalSecondOptions
|
||||
|
||||
const corridorDimension = useRecoilValue(corridorDimensionSelector)
|
||||
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
const { get, post } = useAxios(globalLocaleState)
|
||||
const { getMessage } = useMessage()
|
||||
@ -27,6 +29,36 @@ export function useCanvasSetting() {
|
||||
|
||||
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
||||
|
||||
useEffect(() => {
|
||||
if (!canvas) {
|
||||
return
|
||||
}
|
||||
const { column } = corridorDimension
|
||||
const lengthTexts = canvas.getObjects().filter((obj) => obj.name === 'lengthText')
|
||||
switch (column) {
|
||||
case 'corridorDimension':
|
||||
lengthTexts.forEach((obj) => {
|
||||
if (obj.planeSize) {
|
||||
obj.set({ text: obj.planeSize.toString() })
|
||||
}
|
||||
})
|
||||
break
|
||||
case 'realDimension':
|
||||
lengthTexts.forEach((obj) => {
|
||||
if (obj.actualSize) {
|
||||
obj.set({ text: obj.actualSize.toString() })
|
||||
}
|
||||
})
|
||||
break
|
||||
case 'noneDimension':
|
||||
lengthTexts.forEach((obj) => {
|
||||
obj.set({ text: '' })
|
||||
})
|
||||
break
|
||||
}
|
||||
canvas.renderAll()
|
||||
}, [corridorDimension])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('useCanvasSetting useEffect 실행1')
|
||||
fetchSettings()
|
||||
@ -257,7 +289,7 @@ export function useCanvasSetting() {
|
||||
optionName = ['7']
|
||||
break
|
||||
case 'flowDisplay': //흐름방향 표시
|
||||
optionName = ['arrow']
|
||||
optionName = ['arrow', 'flowText']
|
||||
break
|
||||
case 'trestleDisplay': //가대 표시
|
||||
optionName = ['8']
|
||||
|
||||
@ -693,8 +693,7 @@ export const usePolygon = () => {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const direction = newRoofs.length === 1 ? polygon.direction : representLine.direction
|
||||
const direction = polygon.direction ?? representLine.direction
|
||||
const polygonDirection = polygon.direction
|
||||
|
||||
switch (direction) {
|
||||
@ -723,7 +722,7 @@ export const usePolygon = () => {
|
||||
originY: 'center',
|
||||
selectable: true,
|
||||
defense: defense,
|
||||
direction: newRoofs.length === 1 ? polygonDirection : defense,
|
||||
direction: polygonDirection ?? defense,
|
||||
pitch: pitch,
|
||||
})
|
||||
|
||||
|
||||
@ -185,6 +185,7 @@ export const corridorDimensionSelector = selector({
|
||||
const settingModalFirstOptions = get(settingModalFirstOptionsState)
|
||||
return settingModalFirstOptions.dimensionDisplay.find((option) => option.selected)
|
||||
},
|
||||
dangerouslyAllowMutability: true,
|
||||
})
|
||||
|
||||
// 디스플레이 설정 - 화면 표시
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user