代码优化:提取render类前进回退方法公共逻辑

This commit is contained in:
wanglin2
2023-10-13 13:51:33 +08:00
parent bce2bb8fc4
commit 0a36555343

View File

@@ -462,18 +462,18 @@ class Render {
// 回退
back(step) {
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
let data = this.mindMap.command.back(step)
if (data) {
this.renderTree = data
this.mindMap.render()
}
this.backForward('back', step)
}
// 前进
forward(step) {
this.backForward('forward', step)
}
// 前进回退
backForward(type, step) {
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
let data = this.mindMap.command.forward(step)
const data = this.mindMap.command[type](step)
if (data) {
this.renderTree = data
this.mindMap.render()