From f9d80c75870ea3414e74f1410b829c70dbc5287b Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 8 Aug 2024 19:13:02 +0800 Subject: [PATCH] =?UTF-8?q?style(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/utils/changeComponentsSizeWithScale.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts index 1bd6efdd84..a575253c67 100644 --- a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts +++ b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts @@ -59,8 +59,24 @@ export function changeComponentsSizeWithScale(scale, changeAttrs = needToChangeA scale }) } +export function changeRefComponentsSizeWithScale(componentDataRef, canvasStyleDataRef, scale) { + componentDataRef.forEach(component => { + Object.keys(component.style).forEach(key => { + if (needToChangeAttrs.includes(key)) { + if (key === 'fontSize' && component.style[key] === '') return + // 根据原来的比例获取样式原来的尺寸 + // 再用原来的尺寸 * 现在的比例得出新的尺寸 + component.style[key] = format( + getOriginStyle(component.style[key], canvasStyleDataRef.scale), + scale + ) + } + }) + }) + canvasStyleDataRef.scale = scale +} -export function changeRefComponentsSizeWithScale( +export function changeRefComponentsSizeWithScalePoint( componentDataRef, canvasStyleDataRef, scaleWidth,