refactor:仪表板编辑时,可能出现的跳动问题
This commit is contained in:
parent
5145b19340
commit
8413cf28fb
@ -1603,7 +1603,7 @@ export default {
|
||||
style.height = height
|
||||
style.rotate = this.rotate
|
||||
// this.hasMove = true
|
||||
console.log('recordMatrixCurShadowStyle:t1:' + JSON.stringify(style))
|
||||
// console.log('recordMatrixCurShadowStyle:t1:' + JSON.stringify(style))
|
||||
|
||||
this.$store.commit('setShapeStyle', style)
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ function recalcCellWidth() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
console.log('init')
|
||||
// console.log('init-cellWidth')
|
||||
this.cellWidth = this.baseWidth + this.baseMarginLeft
|
||||
this.cellHeight = this.baseHeight + this.baseMarginTop
|
||||
this.yourList = this.getList()
|
||||
@ -993,7 +993,7 @@ export default {
|
||||
'editor',
|
||||
'linkageSettingStatus',
|
||||
'curLinkageView',
|
||||
'snapshotIndex'
|
||||
'doSnapshotIndex'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
@ -1035,6 +1035,7 @@ export default {
|
||||
// 初始化时componentData 加载可能出现慢的情况 此时重新初始化一下matrix
|
||||
if (newVal.length !== this.lastComponentDataLength) {
|
||||
this.lastComponentDataLength = newVal.length
|
||||
console.log('.initMatrix2')
|
||||
this.initMatrix()
|
||||
}
|
||||
},
|
||||
@ -1047,9 +1048,10 @@ export default {
|
||||
deep: true
|
||||
},
|
||||
// 镜像索引有变化 刷新一下矩阵(撤销重做等)
|
||||
snapshotIndex: {
|
||||
doSnapshotIndex: {
|
||||
handler(newVal, oldVla) {
|
||||
// console.log('snapshotIndexChange:' + newVal)
|
||||
// console.log('.initMatrix3')
|
||||
this.initMatrix()
|
||||
},
|
||||
deep: true
|
||||
@ -1061,11 +1063,11 @@ export default {
|
||||
this.$store.commit('getEditor')
|
||||
const _this = this
|
||||
// bus.$on('auxiliaryMatrixChange', this.initMatrix)
|
||||
bus.$on('auxiliaryMatrixChange', () => {
|
||||
_this.$nextTick(() => {
|
||||
_this.initMatrix()
|
||||
})
|
||||
})
|
||||
// bus.$on('auxiliaryMatrixChange', () => {
|
||||
// _this.$nextTick(() => {
|
||||
// _this.initMatrix()
|
||||
// })
|
||||
// })
|
||||
eventBus.$on('hideArea', () => {
|
||||
this.hideArea()
|
||||
})
|
||||
@ -1300,6 +1302,7 @@ export default {
|
||||
this.baseHeight = this.matrixStyle.height
|
||||
this.cellWidth = this.matrixStyle.width
|
||||
this.cellHeight = this.matrixStyle.height
|
||||
// console.log('.initMatrix1')
|
||||
this.initMatrix()
|
||||
|
||||
this.scaleWidth = this.outStyle.width * 100 / this.canvasStyleData.width
|
||||
|
||||
@ -8,13 +8,15 @@ export default {
|
||||
snapshotIndex: -1, // 快照索引
|
||||
changeTimes: -1, // 修改次数
|
||||
lastSaveSnapshotIndex: 0, // 最后保存是snapshotIndex的索引
|
||||
styleChangeTimes: 0 // 组件样式修改次数
|
||||
styleChangeTimes: 0, // 组件样式修改次数
|
||||
doSnapshotIndex: -1 // snapshot undo redo 时的索引记录
|
||||
},
|
||||
mutations: {
|
||||
undo(state) {
|
||||
store.commit('setCurComponent', { component: null, index: null })
|
||||
if (state.snapshotIndex > 0) {
|
||||
state.snapshotIndex--
|
||||
state.doSnapshotIndex = state.snapshotIndex
|
||||
store.commit('setComponentData', deepCopy(state.snapshotData[state.snapshotIndex]))
|
||||
store.commit('setCanvasStyle', deepCopy(state.snapshotStyleData[state.snapshotIndex]))
|
||||
}
|
||||
@ -24,6 +26,7 @@ export default {
|
||||
store.commit('setCurComponent', { component: null, index: null })
|
||||
if (state.snapshotIndex < state.snapshotData.length - 1) {
|
||||
state.snapshotIndex++
|
||||
state.doSnapshotIndex = state.snapshotIndex
|
||||
store.commit('setComponentData', deepCopy(state.snapshotData[state.snapshotIndex]))
|
||||
store.commit('setCanvasStyle', deepCopy(state.snapshotStyleData[state.snapshotIndex]))
|
||||
}
|
||||
@ -42,6 +45,7 @@ export default {
|
||||
}
|
||||
},
|
||||
refreshSnapshot(state) {
|
||||
console.log('refreshSnapshot')
|
||||
// 刷新快照
|
||||
state.snapshotData = []
|
||||
state.snapshotStyleData = []
|
||||
|
||||
Loading…
Reference in New Issue
Block a user