fix(数据大屏): 修复编辑时全屏预览若缩放方式为铺满全屏会导致退回编辑状态组件大小发生改变问题

This commit is contained in:
wangjiahao 2024-09-02 13:30:28 +08:00
parent 2386cc755c
commit c1a714f25e

View File

@ -25,22 +25,24 @@ export function changeSizeWithScale(scale) {
return changeComponentsSizeWithScale(scale)
}
export function changeSizeWithDirectionScale(scale, direction) {
return changeComponentsSizeWithScale(scale, needToChangeDirectionAttrs[direction])
}
export function changeComponentsSizeWithScale(scale, changeAttrs = needToChangeAttrs) {
export function changeComponentsSizeWithScale(scale) {
const componentDataCopy = deepCopy(componentData.value)
componentDataCopy.forEach(component => {
Object.keys(component.style).forEach(key => {
if (changeAttrs.includes(key)) {
if (['fontSize', 'activeFontSize'].includes(key) && component.style[key] === '') return
if (needToChangeDirectionAttrs.width.includes(key)) {
// 根据原来的比例获取样式原来的尺寸
// 再用原来的尺寸 * 现在的比例得出新的尺寸
component.style[key] = format(
getOriginStyle(component.style[key], canvasStyleData.value.scale),
scale
)
} else if (needToChangeDirectionAttrs.height.includes(key)) {
// 根据原来的比例获取样式原来的尺寸
// 再用原来的尺寸 * 现在的比例得出新的尺寸
component.style[key] = format(
getOriginStyle(component.style[key], canvasStyleData.value.scaleHeight),
scale
)
}
})
// 如果是分组组件 则要进行分组内部组件groupStyle进行深度计算