forked from github/dataease
fix(数据大屏): 修复编辑时全屏预览若缩放方式为铺满全屏会导致退回编辑状态组件大小发生改变问题
This commit is contained in:
parent
2386cc755c
commit
c1a714f25e
@ -25,22 +25,24 @@ export function changeSizeWithScale(scale) {
|
|||||||
return changeComponentsSizeWithScale(scale)
|
return changeComponentsSizeWithScale(scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function changeSizeWithDirectionScale(scale, direction) {
|
export function changeComponentsSizeWithScale(scale) {
|
||||||
return changeComponentsSizeWithScale(scale, needToChangeDirectionAttrs[direction])
|
|
||||||
}
|
|
||||||
|
|
||||||
export function changeComponentsSizeWithScale(scale, changeAttrs = needToChangeAttrs) {
|
|
||||||
const componentDataCopy = deepCopy(componentData.value)
|
const componentDataCopy = deepCopy(componentData.value)
|
||||||
componentDataCopy.forEach(component => {
|
componentDataCopy.forEach(component => {
|
||||||
Object.keys(component.style).forEach(key => {
|
Object.keys(component.style).forEach(key => {
|
||||||
if (changeAttrs.includes(key)) {
|
if (needToChangeDirectionAttrs.width.includes(key)) {
|
||||||
if (['fontSize', 'activeFontSize'].includes(key) && component.style[key] === '') return
|
|
||||||
// 根据原来的比例获取样式原来的尺寸
|
// 根据原来的比例获取样式原来的尺寸
|
||||||
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
||||||
component.style[key] = format(
|
component.style[key] = format(
|
||||||
getOriginStyle(component.style[key], canvasStyleData.value.scale),
|
getOriginStyle(component.style[key], canvasStyleData.value.scale),
|
||||||
scale
|
scale
|
||||||
)
|
)
|
||||||
|
} else if (needToChangeDirectionAttrs.height.includes(key)) {
|
||||||
|
// 根据原来的比例获取样式原来的尺寸
|
||||||
|
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
||||||
|
component.style[key] = format(
|
||||||
|
getOriginStyle(component.style[key], canvasStyleData.value.scaleHeight),
|
||||||
|
scale
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 如果是分组组件 则要进行分组内部组件groupStyle进行深度计算
|
// 如果是分组组件 则要进行分组内部组件groupStyle进行深度计算
|
||||||
|
Loading…
Reference in New Issue
Block a user