폰트 설정 오류 수정
This commit is contained in:
parent
2b29a62616
commit
c8d0dd30e5
@ -12,6 +12,7 @@ export function useFont() {
|
|||||||
const circuitNumberText = useRecoilValue(fontSelector('circuitNumberText'))
|
const circuitNumberText = useRecoilValue(fontSelector('circuitNumberText'))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
if (canvas && commonText.fontWeight.value) {
|
if (canvas && commonText.fontWeight.value) {
|
||||||
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'commonText')
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'commonText')
|
||||||
textObjs.forEach((obj) => {
|
textObjs.forEach((obj) => {
|
||||||
@ -24,71 +25,81 @@ export function useFont() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
}
|
}}, 200)
|
||||||
}, [commonText])
|
}, [commonText])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas && dimensionLineText.fontWeight.value) {
|
setTimeout(() => {
|
||||||
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'dimensionLineText')
|
if (canvas && dimensionLineText.fontWeight.value) {
|
||||||
textObjs.forEach((obj) => {
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'dimensionLineText')
|
||||||
obj.set({
|
textObjs.forEach((obj) => {
|
||||||
fontFamily: dimensionLineText.fontFamily.value,
|
obj.set({
|
||||||
fontWeight: dimensionLineText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
fontFamily: dimensionLineText.fontFamily.value,
|
||||||
fontStyle: dimensionLineText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
fontWeight: dimensionLineText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
||||||
fontSize: dimensionLineText.fontSize.value,
|
fontStyle: dimensionLineText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
||||||
fill: dimensionLineText.fontColor.value,
|
fontSize: dimensionLineText.fontSize.value,
|
||||||
|
fill: dimensionLineText.fontColor.value,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
canvas.renderAll()
|
||||||
canvas.renderAll()
|
}
|
||||||
}
|
}, 200)
|
||||||
|
|
||||||
}, [dimensionLineText])
|
}, [dimensionLineText])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas && flowText.fontWeight.value) {
|
setTimeout(() => {
|
||||||
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'flowText')
|
if (canvas && flowText.fontWeight.value) {
|
||||||
textObjs.forEach((obj) => {
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'flowText')
|
||||||
obj.set({
|
textObjs.forEach((obj) => {
|
||||||
fontFamily: flowText.fontFamily.value,
|
obj.set({
|
||||||
fontWeight: flowText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
fontFamily: flowText.fontFamily.value,
|
||||||
fontStyle: flowText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
fontWeight: flowText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
||||||
fontSize: flowText.fontSize.value,
|
fontStyle: flowText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
||||||
fill: flowText.fontColor.value,
|
fontSize: flowText.fontSize.value,
|
||||||
|
fill: flowText.fontColor.value,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
canvas.renderAll()
|
||||||
canvas.renderAll()
|
}
|
||||||
}
|
}, 200)
|
||||||
|
|
||||||
}, [flowText])
|
}, [flowText])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas && lengthText.fontWeight.value) {
|
setTimeout(() => {
|
||||||
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'lengthText')
|
if (canvas && lengthText.fontWeight.value) {
|
||||||
textObjs.forEach((obj) => {
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'lengthText')
|
||||||
obj.set({
|
textObjs.forEach((obj) => {
|
||||||
fontFamily: lengthText.fontFamily.value,
|
obj.set({
|
||||||
fontWeight: lengthText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
fontFamily: lengthText.fontFamily.value,
|
||||||
fontStyle: lengthText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
fontWeight: lengthText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
||||||
fontSize: lengthText.fontSize.value,
|
fontStyle: lengthText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
||||||
fill: lengthText.fontColor.value,
|
fontSize: lengthText.fontSize.value,
|
||||||
|
fill: lengthText.fontColor.value,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
canvas.renderAll()
|
||||||
canvas.renderAll()
|
}
|
||||||
}
|
}, 200)
|
||||||
}, [lengthText])
|
}, [lengthText])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas && circuitNumberText.fontWeight.value) {
|
setTimeout(() => {
|
||||||
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'circuitNumber')
|
if (canvas && circuitNumberText.fontWeight.value) {
|
||||||
textObjs.forEach((obj) => {
|
const textObjs = canvas?.getObjects().filter((obj) => obj.name === 'circuitNumber')
|
||||||
obj.set({
|
textObjs.forEach((obj) => {
|
||||||
fontFamily: circuitNumberText.fontFamily.value,
|
obj.set({
|
||||||
fontWeight: circuitNumberText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
fontFamily: circuitNumberText.fontFamily.value,
|
||||||
fontStyle: circuitNumberText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
fontWeight: circuitNumberText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
||||||
fontSize: circuitNumberText.fontSize.value,
|
fontStyle: circuitNumberText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
||||||
fill: circuitNumberText.fontColor.value,
|
fontSize: circuitNumberText.fontSize.value,
|
||||||
|
fill: circuitNumberText.fontColor.value,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
canvas.renderAll()
|
||||||
canvas.renderAll()
|
}
|
||||||
}
|
}, 200)
|
||||||
}, [circuitNumberText])
|
}, [circuitNumberText])
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { basicSettingState } from '@/store/settingAtom'
|
|||||||
import { calcLineActualSize } from '@/util/qpolygon-utils'
|
import { calcLineActualSize } from '@/util/qpolygon-utils'
|
||||||
import { getDegreeByChon } from '@/util/canvas-util'
|
import { getDegreeByChon } from '@/util/canvas-util'
|
||||||
import { useText } from '@/hooks/useText'
|
import { useText } from '@/hooks/useText'
|
||||||
|
import { fontSelector } from '@/store/fontAtom'
|
||||||
|
|
||||||
export const useLine = () => {
|
export const useLine = () => {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -23,14 +24,15 @@ export const useLine = () => {
|
|||||||
const angleUnit = useRecoilValue(showAngleUnitSelector)
|
const angleUnit = useRecoilValue(showAngleUnitSelector)
|
||||||
const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet
|
const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet
|
||||||
const globalPitch = useRecoilValue(globalPitchState)
|
const globalPitch = useRecoilValue(globalPitchState)
|
||||||
|
const lengthText = useRecoilValue(fontSelector('lengthText'))
|
||||||
|
|
||||||
const { changeCorridorDimensionText } = useText()
|
const { changeCorridorDimensionText } = useText()
|
||||||
|
|
||||||
const addLine = (points = [], options) => {
|
const addLine = (points = [], options) => {
|
||||||
const line = new QLine(points, {
|
const line = new QLine(points, {
|
||||||
...options,
|
...options,
|
||||||
fontSize: fontSize,
|
fontSize: lengthText.fontSize.value,
|
||||||
fontFamily: fontFamily,
|
fontFamily: lengthText.fontFamily.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (line.length < 1) {
|
if (line.length < 1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user