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