Merge pull request #11804 from dataease/pr@dev-v2@fix_tab-title

fix(数据大屏、仪表板): 修复画布缩放偏离较大时Tab表头非激活字体和预设值偏离较大问题
This commit is contained in:
王嘉豪 2024-08-28 11:36:07 +08:00 committed by GitHub
commit 45f70a54c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,9 +7,17 @@ import { groupSizeStyleAdaptor } from '@/utils/style'
const dvMainStore = dvMainStoreWithOut()
const { componentData, curComponentIndex, canvasStyleData } = storeToRefs(dvMainStore)
const needToChangeAttrs = ['top', 'left', 'width', 'height', 'fontSize', 'letterSpacing']
const needToChangeAttrs = [
'top',
'left',
'width',
'height',
'fontSize',
'activeFontSize',
'letterSpacing'
]
const needToChangeDirectionAttrs = {
width: ['left', 'width', 'fontSize', 'letterSpacing'],
width: ['left', 'width', 'fontSize', 'activeFontSize', 'letterSpacing'],
height: ['top', 'height']
}
@ -26,7 +34,7 @@ export function changeComponentsSizeWithScale(scale, changeAttrs = needToChangeA
componentDataCopy.forEach(component => {
Object.keys(component.style).forEach(key => {
if (changeAttrs.includes(key)) {
if (key === 'fontSize' && component.style[key] === '') return
if (['fontSize', 'activeFontSize'].includes(key) && component.style[key] === '') return
// 根据原来的比例获取样式原来的尺寸
// 再用原来的尺寸 * 现在的比例得出新的尺寸
component.style[key] = format(