fix(数据大屏、仪表板): 修复tab,分组内部组件快捷键移动未保存问题

This commit is contained in:
wangjiahao 2024-10-14 14:14:44 +08:00
parent bb9066da99
commit 300e621921

View File

@ -6,6 +6,8 @@ import { composeStoreWithOut } from '@/store/modules/data-visualization/compose'
import { lockStoreWithOut } from '@/store/modules/data-visualization/lock' import { lockStoreWithOut } from '@/store/modules/data-visualization/lock'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { getCurInfo } from '@/store/modules/data-visualization/common' import { getCurInfo } from '@/store/modules/data-visualization/common'
import { isGroupCanvas, isTabCanvas } from '@/utils/canvasUtils'
import { groupStyleRevert } from '@/utils/style'
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const composeStore = composeStoreWithOut() const composeStore = composeStoreWithOut()
@ -191,10 +193,14 @@ function move(keyCode) {
} }
function groupAreaAdaptor(leftOffset = 0, topOffset = 0) { function groupAreaAdaptor(leftOffset = 0, topOffset = 0) {
if (curComponent.value.component === 'GroupArea') { const canvasId = curComponent.value.canvasId
composeStore.areaData.components.forEach(component => { const parentNode = document.querySelector('#editor-' + canvasId)
component.style.top = component.style.top + topOffset
component.style.left = component.style.left + leftOffset //如果当前画布是Group内部画布 则对应组件定位在resize时要还原到groupStyle中
if (isGroupCanvas(canvasId) || isTabCanvas(canvasId)) {
groupStyleRevert(curComponent.value, {
width: parentNode.offsetWidth,
height: parentNode.offsetHeight
}) })
} }
} }