refactor: 大屏字体修改,同步修改图表标题字体
This commit is contained in:
parent
a81cdbb074
commit
283804828f
@ -236,6 +236,7 @@ const dvMainStore = dvMainStoreWithOut()
|
||||
const { canvasStyleData, dvInfo } = storeToRefs(dvMainStore)
|
||||
import {
|
||||
adaptCurThemeCommonStyleAll,
|
||||
adaptTitleFontFamilyAll,
|
||||
DARK_THEME_DASHBOARD_BACKGROUND,
|
||||
LIGHT_THEME_DASHBOARD_BACKGROUND
|
||||
} from '@/utils/canvasStyle'
|
||||
@ -303,6 +304,8 @@ const fontFamilyChange = () => {
|
||||
'--de-canvas_custom_font',
|
||||
`${canvasStyleData.value.fontFamily}`
|
||||
)
|
||||
adaptTitleFontFamilyAll(canvasStyleData.value.fontFamily)
|
||||
snapshotStore.recordSnapshotCache('renderChart')
|
||||
}
|
||||
|
||||
const themeChange = (modifyName?) => {
|
||||
|
||||
@ -84,6 +84,7 @@ import { ElFormItem, ElIcon } from 'element-plus-secondary'
|
||||
import Icon from '../icon-custom/src/Icon.vue'
|
||||
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
|
||||
import { CHART_FONT_FAMILY } from '@/views/chart/components/editor/util/chart'
|
||||
import { adaptTitleFontFamilyAll } from '@/utils/canvasStyle'
|
||||
const snapshotStore = snapshotStoreWithOut()
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
@ -101,6 +102,8 @@ const onFontFamilyChange = () => {
|
||||
'--de-canvas_custom_font',
|
||||
`${canvasStyleData.value.fontFamily}`
|
||||
)
|
||||
adaptTitleFontFamilyAll(canvasStyleData.value.fontFamily)
|
||||
snapshotStore.recordSnapshotCache('renderChart')
|
||||
}
|
||||
const onThemeChange = () => {
|
||||
snapshotStore.recordSnapshotCache()
|
||||
|
||||
@ -421,6 +421,41 @@ export function adaptCurTheme(customStyle, customAttr) {
|
||||
}
|
||||
}
|
||||
|
||||
export function adaptTitleFontFamily(fontFamily, viewInfo) {
|
||||
if (viewInfo) {
|
||||
viewInfo.customStyle['text']['fontFamily'] = fontFamily
|
||||
}
|
||||
}
|
||||
|
||||
export function adaptTitleFontFamilyAll(fontFamily) {
|
||||
const componentData = dvMainStore.componentData
|
||||
componentData.forEach(item => {
|
||||
if (item.component === 'UserView') {
|
||||
const viewDetails = dvMainStore.canvasViewInfo[item.id]
|
||||
adaptTitleFontFamily(fontFamily, viewDetails)
|
||||
useEmitt().emitter.emit('renderChart-' + item.id, viewDetails)
|
||||
} else if (item.component === 'Group') {
|
||||
item.propValue.forEach(groupItem => {
|
||||
if (groupItem.component === 'UserView') {
|
||||
const viewDetails = dvMainStore.canvasViewInfo[item.id]
|
||||
adaptTitleFontFamily(fontFamily, viewDetails)
|
||||
useEmitt().emitter.emit('renderChart-' + item.id, viewDetails)
|
||||
}
|
||||
})
|
||||
} else if (item.component === 'DeTabs') {
|
||||
item.propValue.forEach(tabItem => {
|
||||
tabItem.componentData.forEach(tabComponent => {
|
||||
if (tabComponent.component === 'UserView') {
|
||||
const viewDetails = dvMainStore.canvasViewInfo[item.id]
|
||||
adaptTitleFontFamily(fontFamily, viewDetails)
|
||||
useEmitt().emitter.emit('renderChart-' + item.id, viewDetails)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function adaptCurThemeCommonStyle(component) {
|
||||
if (['DeTabs'].includes(component.component)) {
|
||||
component.commonBackground['innerPadding'] = 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user