Fix:不完美的解决逻辑结构图概要和节点的冲突问题

This commit is contained in:
wanglin2 2023-09-09 11:35:13 +08:00
parent af87f84ce8
commit 0d5602b832

View File

@ -56,6 +56,9 @@ class LogicalStructure extends Base {
}, 0) + }, 0) +
(len + 1) * this.getMarginY(layerIndex + 1) (len + 1) * this.getMarginY(layerIndex + 1)
: 0 : 0
// 如果存在概要,则和概要的高度取最大值
let generalizationNodeHeight = cur._node.checkHasGeneralization() ? cur._node._generalizationNodeHeight + this.getMarginY(layerIndex + 1) : 0
cur._node.childrenAreaHeight2 = Math.max(cur._node.childrenAreaHeight, generalizationNodeHeight)
}, },
true, true,
0 0
@ -99,9 +102,8 @@ class LogicalStructure extends Base {
} }
// 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置 // 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置
let difference = let difference =
node.childrenAreaHeight - node.childrenAreaHeight2 -
this.getMarginY(layerIndex + 1) * 2 - this.getMarginY(layerIndex + 1) * 2 - node.height
node.height
if (difference > 0) { if (difference > 0) {
this.updateBrothers(node, difference / 2) this.updateBrothers(node, difference / 2)
} }