From 72b19f39429723a125c6df6ccfbfcb87f46a6556 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Sun, 18 Feb 2024 13:31:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E4=BD=8D=E7=BD=AE=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=A4=84=E6=89=8B=E5=8A=A8=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=AE=BD=E9=AB=98=E9=80=BB=E8=BE=91=EF=BC=8C=E9=80=82=E9=85=8D?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E5=AE=BD=E9=AB=98=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualization/common/ComponentPosition.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/core-frontend/src/components/visualization/common/ComponentPosition.vue b/core/core-frontend/src/components/visualization/common/ComponentPosition.vue index 5383109bd1..eb09577e50 100644 --- a/core/core-frontend/src/components/visualization/common/ComponentPosition.vue +++ b/core/core-frontend/src/components/visualization/common/ComponentPosition.vue @@ -82,9 +82,19 @@ const onPositionChange = key => { if (!positionMounted.value[key]) { positionMounted.value[key] = 0 } + const originRadio = curComponent.value.style.width / curComponent.value.style.height curComponent.value.style[key] = Math.round( (positionMounted.value[key] * canvasStyleData.value.scale) / 100 ) + if (curComponent.value.maintainRadio) { + if (key === 'width') { + curComponent.value.style['height'] = curComponent.value.style['width'] / originRadio + positionMounted.value['height'] = Math.round(positionMounted.value['width'] / originRadio) + } else if (key === 'height') { + curComponent.value.style['width'] = curComponent.value.style['height'] * originRadio + positionMounted.value['width'] = Math.round(positionMounted.value['height'] * originRadio) + } + } if (curComponent.value.component === 'Group') { //如果当前组件是Group分组 则要进行内部组件深度计算