From d8c7aee2b6e1d41d8d161cb78da0a2ef7a2e1e3d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 23 May 2024 09:50:09 +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=E5=A4=9A=E9=80=89=E5=9B=BE=E5=B1=82=E6=96=B9?= =?UTF-8?q?=E5=90=91=E9=94=AE=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98=20#9766?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/DeShortcutKey.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/core-frontend/src/utils/DeShortcutKey.ts b/core/core-frontend/src/utils/DeShortcutKey.ts index f1bef64f21..a3465ded97 100644 --- a/core/core-frontend/src/utils/DeShortcutKey.ts +++ b/core/core-frontend/src/utils/DeShortcutKey.ts @@ -174,17 +174,30 @@ function move(keyCode) { if (curComponent.value) { if (keyCode === leftKey) { curComponent.value.style.left = --curComponent.value.style.left + groupAreaAdaptor(-1, 0) } else if (keyCode === rightKey) { curComponent.value.style.left = ++curComponent.value.style.left + groupAreaAdaptor(1, 0) } else if (keyCode === upKey) { curComponent.value.style.top = --curComponent.value.style.top + groupAreaAdaptor(0, -1) } else if (keyCode === downKey) { curComponent.value.style.top = ++curComponent.value.style.top + groupAreaAdaptor(0, 1) } snapshotStore.recordSnapshotCache('key-move') } } +function groupAreaAdaptor(leftOffset = 0, topOffset = 0) { + if (curComponent.value.component === 'GroupArea') { + composeStore.areaData.components.forEach(component => { + component.style.top = component.style.top + topOffset + component.style.left = component.style.left + leftOffset + }) + } +} + function cut() { copyStore.cut() }