폰트 관련 기능 수정

This commit is contained in:
minsik 2024-11-27 10:03:48 +09:00
parent a1f0806bcc
commit 5fc9779490

View File

@ -7,7 +7,7 @@ import { useAxios } from '@/hooks/useAxios'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import { correntObjectNoState, corridorDimensionSelector, settingModalFirstOptionsState, settingModalSecondOptionsState } from '@/store/settingAtom' import { correntObjectNoState, corridorDimensionSelector, settingModalFirstOptionsState, settingModalSecondOptionsState } from '@/store/settingAtom'
import { POLYGON_TYPE } from '@/common/common' import { POLYGON_TYPE } from '@/common/common'
import { fontSelector, globalFontAtom } from '@/store/fontAtom' import { globalFontAtom } from '@/store/fontAtom'
import { dimensionLineSettingsState } from '@/store/commonUtilsAtom' import { dimensionLineSettingsState } from '@/store/commonUtilsAtom'
let objectNo let objectNo
@ -119,21 +119,23 @@ export function useCanvasSetting() {
}, [planSizeSettingMode]) }, [planSizeSettingMode])
const getFonts = (itemValue) => { const getFonts = (itemValue) => {
if (!itemValue) return { id: 1, name: 'MS PGothic', value: 'MS PGothic' }
const data = [ const data = [
{ id: 1, name: 'MS PGothic', value: 'MS PGothic' }, { id: 1, name: 'MS PGothic', value: 'MS PGothic' },
{ id: 2, name: '@Yu Gothic', value: '@Yu Gothic' }, { id: 2, name: '@Yu Gothic', value: '@Yu Gothic' },
{ id: 3, name: 'Yu Gothic', value: 'Yu Gothic' }, { id: 3, name: 'Yu Gothic', value: 'Yu Gothic' },
{ id: 4, name: '@Yu Gothic UI', value: '@Yu Gothic UI' }, { id: 4, name: '@Yu Gothic UI', value: '@Yu Gothic UI' },
{ id: 5, name: 'Yu Gothic UI', value: 'Yu Gothic UI' }, { id: 5, name: 'Yu Gothic UI', value: 'Yu Gothic UI' },
].filter((font) => font.value === itemValue)[0] ].filter((font) => font.value === itemValue)
if (data.length !== 0) { if (data.length !== 0) {
return data return data[0]
} else { } else {
return { id: 1, name: 'MS PGothic', value: 'MS PGothic' } return { id: 1, name: 'MS PGothic', value: 'MS PGothic' }
} }
} }
const getFontSizes = (itemValue) => { const getFontSizes = (itemValue) => {
if (!itemValue) return { id: 16, name: 16, value: 16 }
const data = [ const data = [
...Array.from({ length: 4 }).map((_, index) => { ...Array.from({ length: 4 }).map((_, index) => {
return { id: index + 8, name: index + 8, value: index + 8 } return { id: index + 8, name: index + 8, value: index + 8 }
@ -144,29 +146,31 @@ export function useCanvasSetting() {
{ id: 36, name: 36, value: 36 }, { id: 36, name: 36, value: 36 },
{ id: 48, name: 48, value: 48 }, { id: 48, name: 48, value: 48 },
{ id: 72, name: 72, value: 72 }, { id: 72, name: 72, value: 72 },
].filter((fontSize) => fontSize.value === itemValue)[0] ].filter((fontSize) => fontSize.value === itemValue)
if (data.length !== 0) { if (data.length !== 0) {
return data return data[0]
} else { } else {
return { id: 16, name: 16, value: 16 } return { id: 16, name: 16, value: 16 }
} }
} }
const getFontStyles = (itemValue) => { const getFontStyles = (itemValue) => {
if (!itemValue) return { id: 'normal', name: getMessage('font.style.normal'), value: 'normal' }
const data = [ const data = [
{ id: 'normal', name: getMessage('font.style.normal'), value: 'normal' }, { id: 'normal', name: getMessage('font.style.normal'), value: 'normal' },
{ id: 'italic', name: getMessage('font.style.italic'), value: 'italic' }, { id: 'italic', name: getMessage('font.style.italic'), value: 'italic' },
{ id: 'bold', name: getMessage('font.style.bold'), value: 'bold' }, { id: 'bold', name: getMessage('font.style.bold'), value: 'bold' },
{ id: 'boldAndItalic', name: getMessage('font.style.bold.italic'), value: 'boldAndItalic' }, { id: 'boldAndItalic', name: getMessage('font.style.bold.italic'), value: 'boldAndItalic' },
].filter((fontStyle) => fontStyle.value === itemValue)[0] ].filter((fontStyle) => fontStyle.value === itemValue)
if (data.length !== 0) { if (data.length !== 0) {
return data return data[0]
} else { } else {
return { id: 'normal', name: getMessage('font.style.normal'), value: 'normal' } return { id: 'normal', name: getMessage('font.style.normal'), value: 'normal' }
} }
} }
const getFontColors = (itemValue) => { const getFontColors = (itemValue) => {
if (!itemValue) return { id: 'black', name: getMessage('color.black'), value: 'black' }
const data = [ const data = [
{ id: 'black', name: getMessage('color.black'), value: 'black' }, { id: 'black', name: getMessage('color.black'), value: 'black' },
{ id: 'red', name: getMessage('color.red'), value: 'red' }, { id: 'red', name: getMessage('color.red'), value: 'red' },
@ -177,9 +181,9 @@ export function useCanvasSetting() {
{ id: 'pink', name: getMessage('color.pink'), value: 'pink' }, { id: 'pink', name: getMessage('color.pink'), value: 'pink' },
{ id: 'gold', name: getMessage('color.gold'), value: 'gold' }, { id: 'gold', name: getMessage('color.gold'), value: 'gold' },
{ id: 'darkblue', name: getMessage('color.darkblue'), value: 'darkblue' }, { id: 'darkblue', name: getMessage('color.darkblue'), value: 'darkblue' },
].filter((fontColor) => fontColor.value === itemValue)[0] ].filter((fontColor) => fontColor.value === itemValue)
if (data.length !== 0) { if (data.length !== 0) {
return data return data[0]
} else { } else {
return { id: 'black', name: getMessage('color.black'), value: 'black' } return { id: 'black', name: getMessage('color.black'), value: 'black' }
} }