优化代码:render类中删除和更新概要时无需手动调用更新方法

This commit is contained in:
wanglin2 2023-10-16 09:19:43 +08:00
parent 8e43cd609f
commit e263eb8252

View File

@ -989,7 +989,6 @@ class Render {
generalization: null generalization: null
} }
) )
node.generalizationBelongNode.update()
this.removeNodeFromActiveList(node) this.removeNodeFromActiveList(node)
i-- i--
} else { } else {
@ -1032,7 +1031,6 @@ class Render {
generalization: null generalization: null
} }
) )
node.generalizationBelongNode.update()
} else { } else {
const parent = node.parent const parent = node.parent
const index = getNodeDataIndex(node) const index = getNodeDataIndex(node)
@ -1230,7 +1228,7 @@ class Render {
this.renderTree, this.renderTree,
null, null,
(node, parent, isRoot) => { (node, parent, isRoot) => {
if (!isRoot && (node.children && node.children.length > 0)) { if (!isRoot && node.children && node.children.length > 0) {
node.data.expand = false node.data.expand = false
} }
}, },
@ -1253,7 +1251,7 @@ class Render {
const expand = layerIndex < level const expand = layerIndex < level
if (expand) { if (expand) {
node.data.expand = true node.data.expand = true
} else if (!isRoot && (node.children && node.children.length > 0)) { } else if (!isRoot && node.children && node.children.length > 0) {
node.data.expand = false node.data.expand = false
} }
}, },
@ -1456,10 +1454,6 @@ class Render {
this.mindMap.execCommand('SET_NODE_DATA', node, data) this.mindMap.execCommand('SET_NODE_DATA', node, data)
let changed = node.reRender() let changed = node.reRender()
if (changed) { if (changed) {
if (node.isGeneralization) {
// 概要节点
node.generalizationBelongNode.updateGeneralization()
}
if (!notRender) this.mindMap.render() if (!notRender) this.mindMap.render()
} else { } else {
this.mindMap.emit('node_tree_render_end') this.mindMap.emit('node_tree_render_end')