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