From 8508cf2ef4bcc2af7a8b5804abd62ac0b6c4fe1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=98=89=E8=B1=AA?= <42510293+ziyujiahao@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:20:08 +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=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F=E5=B0=86?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=92=8C=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=BB=84=E5=90=88=EF=BC=88=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=EF=BC=89=EF=BC=8C=E5=A4=A7=E5=B1=8F=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=97=AE=E9=A2=98=E3=80=82=20#17278=20(#1743?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/changeComponentsSizeWithScale.ts | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts index 64a8348b57..342aed3ea1 100644 --- a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts +++ b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts @@ -35,26 +35,27 @@ function changeComponentsSizeWithScaleCircle(componentDataCopy, scale) { return } componentDataCopy?.forEach(component => { - Object.keys(component.style).forEach(key => { - if (needToChangeDirectionAttrs.width.includes(key)) { - // 根据原来的比例获取样式原来的尺寸 - // 再用原来的尺寸 * 现在的比例得出新的尺寸 - if (!!component.style[key]) { + if (component.style) { + Object.keys(component.style)?.forEach(key => { + if (needToChangeDirectionAttrs.width.includes(key)) { + // 根据原来的比例获取样式原来的尺寸 + // 再用原来的尺寸 * 现在的比例得出新的尺寸 + if (!!component.style[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.scale), + getOriginStyle(component.style[key], canvasStyleData.value.scaleHeight), scale ) } - } else if (needToChangeDirectionAttrs.height.includes(key)) { - // 根据原来的比例获取样式原来的尺寸 - // 再用原来的尺寸 * 现在的比例得出新的尺寸 - component.style[key] = format( - getOriginStyle(component.style[key], canvasStyleData.value.scaleHeight), - scale - ) - } - }) - + }) + } if (['Group'].includes(component.component)) { groupSizeStyleAdaptor(component) const parentStyle = component.style @@ -129,7 +130,7 @@ export function changeRefComponentsSizeWithScalePointCircle( outScale ) { componentDataRef.forEach(component => { - Object.keys(component.style).forEach(key => { + Object.keys(component.style)?.forEach(key => { if (needToChangeDirectionAttrs.width.includes(key)) { // 根据原来的比例获取样式原来的尺寸 // 再用原来的尺寸 * 现在的比例得出新的尺寸