优化:切换结构时重置画布缩放,以修复当存在缩放时切换结构后第一次拖动会突变的问题

This commit is contained in:
wanglin2 2023-04-18 16:59:12 +08:00
parent e676bff453
commit f2521f663e
2 changed files with 5 additions and 0 deletions

View File

@ -281,6 +281,7 @@ class MindMap {
layout = CONSTANTS.LAYOUT.LOGICAL_STRUCTURE
}
this.opt.layout = layout
this.view.reset()
this.renderer.setLayout()
this.render()
}

View File

@ -167,10 +167,14 @@ class View {
// 恢复
reset() {
let scaleChange = this.scale !== 1
this.scale = 1
this.x = 0
this.y = 0
this.transform()
if (scaleChange) {
this.mindMap.emit('scale', this.scale)
}
}
// 缩小