Fix:不完美的解决思维导图结构概要和节点的冲突问题
This commit is contained in:
parent
0d5602b832
commit
4c9c34a0ea
@ -90,6 +90,11 @@ class MindMap extends Base {
|
|||||||
cur._node.rightChildrenAreaHeight =
|
cur._node.rightChildrenAreaHeight =
|
||||||
rightChildrenAreaHeight +
|
rightChildrenAreaHeight +
|
||||||
(rightLen + 1) * this.getMarginY(layerIndex + 1)
|
(rightLen + 1) * this.getMarginY(layerIndex + 1)
|
||||||
|
|
||||||
|
// 如果存在概要,则和概要的高度取最大值
|
||||||
|
let generalizationNodeHeight = cur._node.checkHasGeneralization() ? cur._node._generalizationNodeHeight + this.getMarginY(layerIndex + 1) : 0
|
||||||
|
cur._node.leftChildrenAreaHeight2 = Math.max(cur._node.leftChildrenAreaHeight, generalizationNodeHeight)
|
||||||
|
cur._node.rightChildrenAreaHeight2 = Math.max(cur._node.rightChildrenAreaHeight, generalizationNodeHeight)
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
0
|
0
|
||||||
@ -139,8 +144,8 @@ class MindMap extends Base {
|
|||||||
}
|
}
|
||||||
// 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置
|
// 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置
|
||||||
let base = this.getMarginY(layerIndex + 1) * 2 + node.height
|
let base = this.getMarginY(layerIndex + 1) * 2 + node.height
|
||||||
let leftDifference = node.leftChildrenAreaHeight - base
|
let leftDifference = node.leftChildrenAreaHeight2 - base
|
||||||
let rightDifference = node.rightChildrenAreaHeight - base
|
let rightDifference = node.rightChildrenAreaHeight2 - base
|
||||||
if (leftDifference > 0 || rightDifference > 0) {
|
if (leftDifference > 0 || rightDifference > 0) {
|
||||||
this.updateBrothers(node, leftDifference / 2, rightDifference / 2)
|
this.updateBrothers(node, leftDifference / 2, rightDifference / 2)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user