Merge pull request #9785 from dataease/pr@dev-v2@fix_group-move-key

fix(数据大屏): 修复多选图层方向键失效问题 #9766
This commit is contained in:
王嘉豪 2024-05-23 09:51:11 +08:00 committed by GitHub
commit 2ebd61cc65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()
}