修复先给自身添加概要,再给下级添加概要会出现概要重叠的问题
This commit is contained in:
parent
bc2a5b214f
commit
4db6bda193
@ -1400,10 +1400,12 @@ class Render {
|
|||||||
if (this.activeNodeList.length <= 0) {
|
if (this.activeNodeList.length <= 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let hasAncestorsExistGeneralization = false
|
||||||
this.activeNodeList.forEach(node => {
|
this.activeNodeList.forEach(node => {
|
||||||
if (node.getData('generalization') || node.isRoot) {
|
if (node.getData('generalization') || node.isRoot) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
hasAncestorsExistGeneralization = node.ancestorHasGeneralization()
|
||||||
this.mindMap.execCommand('SET_NODE_DATA', node, {
|
this.mindMap.execCommand('SET_NODE_DATA', node, {
|
||||||
generalization: data || {
|
generalization: data || {
|
||||||
text: this.mindMap.opt.defaultGeneralizationText
|
text: this.mindMap.opt.defaultGeneralizationText
|
||||||
@ -1414,7 +1416,12 @@ class Render {
|
|||||||
expand: true
|
expand: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.mindMap.render()
|
this.mindMap.render(() => {
|
||||||
|
// 修复祖先节点存在概要时位置未更新的问题
|
||||||
|
if (hasAncestorsExistGeneralization) {
|
||||||
|
this.mindMap.render()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除节点概要
|
// 删除节点概要
|
||||||
|
|||||||
@ -849,7 +849,7 @@ class Node {
|
|||||||
return this.customLeft !== undefined && this.customTop !== undefined
|
return this.customLeft !== undefined && this.customTop !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查节点是否存在自定义位置的祖先节点
|
// 检查节点是否存在自定义位置的祖先节点,包含自身
|
||||||
ancestorHasCustomPosition() {
|
ancestorHasCustomPosition() {
|
||||||
let node = this
|
let node = this
|
||||||
while (node) {
|
while (node) {
|
||||||
@ -861,6 +861,18 @@ class Node {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查是否存在概要的祖先节点
|
||||||
|
ancestorHasGeneralization() {
|
||||||
|
let node = this.parent
|
||||||
|
while (node) {
|
||||||
|
if (node.getData('generalization')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
node = node.parent
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// 添加子节点
|
// 添加子节点
|
||||||
addChildren(node) {
|
addChildren(node) {
|
||||||
this.children.push(node)
|
this.children.push(node)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user