forked from github/dataease
Merge pull request #6427 from dataease/pr@dev-v2@refactor_matrix
refactor: 矩阵移动定位优化
This commit is contained in:
commit
6d4a1e99b6
@ -83,36 +83,40 @@ export const copyStore = defineStore('copy', {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const dataArray = this.copyData.data
|
const dataArray = this.copyData.data
|
||||||
dataArray.forEach(data => {
|
|
||||||
if (dvInfo.value.type === 'dataV') {
|
let i = 0
|
||||||
if (isMouse) {
|
const copyDataTemp = this.copyData
|
||||||
data.style.top = menuTop
|
const moveTime = dataArray.length > 1 ? 300 : 10
|
||||||
data.style.left = menuLeft
|
const timeId = setInterval(function () {
|
||||||
} else {
|
if (i >= dataArray.length) {
|
||||||
data.style.top += 10
|
clearInterval(timeId)
|
||||||
data.style.left += 10
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 向下移动一个高度矩阵单位
|
const data = dataArray[i]
|
||||||
data.y = data.y + data.sizeY
|
if (dvInfo.value.type === 'dataV') {
|
||||||
}
|
if (isMouse) {
|
||||||
// 旧-新ID映射关系
|
data.style.top = menuTop
|
||||||
const idMap = {}
|
data.style.left = menuLeft
|
||||||
const newComponent = deepCopyHelper(data, idMap)
|
} else {
|
||||||
dvMainStore.addCopyComponent(newComponent, idMap, this.copyData.copyCanvasViewInfo)
|
data.style.top += 10
|
||||||
if (dvInfo.value.type === 'dashboard') {
|
data.style.left += 10
|
||||||
if (dvMainStore.multiplexingStyleAdapt && this.copyData.copyFrom === 'multiplexing') {
|
}
|
||||||
adaptCurThemeCommonStyle(newComponent)
|
} else {
|
||||||
|
// 向下移动一个高度矩阵单位
|
||||||
|
data.y = data.y + data.sizeY
|
||||||
}
|
}
|
||||||
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
|
// 旧-新ID映射关系
|
||||||
|
const idMap = {}
|
||||||
|
const newComponent = deepCopyHelper(data, idMap)
|
||||||
|
dvMainStore.addCopyComponent(newComponent, idMap, copyDataTemp.copyCanvasViewInfo)
|
||||||
|
if (dvInfo.value.type === 'dashboard') {
|
||||||
|
if (dvMainStore.multiplexingStyleAdapt && copyDataTemp.copyFrom === 'multiplexing') {
|
||||||
|
adaptCurThemeCommonStyle(newComponent)
|
||||||
|
}
|
||||||
|
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
|
||||||
|
}
|
||||||
|
i++
|
||||||
}
|
}
|
||||||
})
|
}, moveTime)
|
||||||
if (dvInfo.value.type === 'dashboard' && dataArray.length > 1) {
|
|
||||||
//占位优化 整合定位
|
|
||||||
setTimeout(() => {
|
|
||||||
eventBus.emit('doCanvasInit-canvas-main')
|
|
||||||
}, 1000)
|
|
||||||
}
|
|
||||||
snapshotStore.recordSnapshotCache()
|
snapshotStore.recordSnapshotCache()
|
||||||
},
|
},
|
||||||
cut() {
|
cut() {
|
||||||
|
Loading…
Reference in New Issue
Block a user