forked from github/dataease
fix(数据大屏): 修复使用位置编辑按钮移动位置时,保存后的分组和Tab组件位置可能被还原问题
This commit is contained in:
parent
20e4592ae1
commit
297d8f3be2
@ -93,7 +93,10 @@ import { storeToRefs } from 'pinia'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import _ from 'lodash'
|
||||
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
||||
import { groupSizeStyleAdaptor } from '@/utils/style'
|
||||
import { groupSizeStyleAdaptor, groupStyleRevert } from '@/utils/style'
|
||||
import { isGroupCanvas, isTabCanvas } from '@/utils/canvasUtils'
|
||||
const parentNode = ref(null)
|
||||
const canvasId = ref('canvas-main')
|
||||
const snapshotStore = snapshotStoreWithOut()
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
@ -158,6 +161,14 @@ const onPositionChange = key => {
|
||||
curComponent.value.style[key] = (positionMounted.value[key] * canvasStyleData.value.scale) / 100
|
||||
}
|
||||
|
||||
//如果当前画布是Group内部画布 则对应组件定位在resize时要还原到groupStyle中
|
||||
if (isGroupCanvas(canvasId.value) || isTabCanvas(canvasId.value)) {
|
||||
groupStyleRevert(curComponent.value, {
|
||||
width: parentNode.value.offsetWidth,
|
||||
height: parentNode.value.offsetHeight
|
||||
})
|
||||
}
|
||||
|
||||
if (['Group', 'DeTabs'].includes(curComponent.value.component)) {
|
||||
//如果当前组件是Group分组或者Tab 则要进行内部组件深度计算
|
||||
groupSizeStyleAdaptor(curComponent.value)
|
||||
@ -176,6 +187,8 @@ const multiDimensionalChange = () => {
|
||||
|
||||
const positionInit = () => {
|
||||
if (curComponent.value) {
|
||||
canvasId.value = curComponent.value.canvasId
|
||||
parentNode.value = document.querySelector('#editor-' + canvasId.value)
|
||||
Object.keys(positionMounted.value).forEach(key => {
|
||||
positionMounted.value[key] = Math.round(
|
||||
(curComponent.value.style[key] * 100) / canvasStyleData.value.scale
|
||||
|
Loading…
Reference in New Issue
Block a user