From c1a714f25e6e90c4e0d03c0cdde2bc6a2619b286 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 2 Sep 2024 13:30:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91=E6=97=B6=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E8=8B=A5=E7=BC=A9=E6=94=BE=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E4=B8=BA=E9=93=BA=E6=BB=A1=E5=85=A8=E5=B1=8F=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E9=80=80=E5=9B=9E=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E5=8F=91=E7=94=9F=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/utils/changeComponentsSizeWithScale.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts index 0e4100057e..efa37f65cb 100644 --- a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts +++ b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts @@ -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进行深度计算