Skip to content

Commit 6bbea92

Browse files
xiaozhao8woai3c
authored andcommitted
fix: snapshot 拖拽缩放问题修改
1 parent e839e68 commit 6bbea92

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/store/snapshot.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,13 @@ export default {
2222
if (state.snapshotIndex >= 0) {
2323
state.snapshotIndex--
2424
let componentData = deepCopy(state.snapshotData[state.snapshotIndex]) || getDefaultcomponentData()
25-
if (state.curComponent) {
26-
// 如果当前组件不在 componentData 中,则置空
27-
const needClean = !componentData.find((component) => state.curComponent.id === component.id)
2825

29-
if (needClean) {
30-
store.commit('setCurComponent', {
31-
component: null,
32-
index: null,
33-
})
34-
}
35-
}
3626
componentData = changeComponentsSizeWithScale(state.lastScale, componentData)
3727
store.commit('setComponentData', componentData)
28+
// 更新当前选中组件的引用
29+
const curComponent = componentData.find((component) => component.id === state.curComponent?.id)
30+
const index = curComponent ? componentData.indexOf(curComponent) : null
31+
store.commit('setCurComponent', { component: curComponent, index })
3832
}
3933
},
4034

0 commit comments

Comments
 (0)