Fix:不完美修复目录组织图概要和节点冲突的问题
This commit is contained in:
parent
4c9c34a0ea
commit
fb41653d79
@ -202,9 +202,13 @@ class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 递归计算节点的宽度
|
// 递归计算节点的宽度
|
||||||
getNodeAreaWidth(node) {
|
getNodeAreaWidth(node, withGeneralization = false) {
|
||||||
let widthArr = []
|
let widthArr = []
|
||||||
|
let totalGeneralizationNodeWidth = 0
|
||||||
let loop = (node, width) => {
|
let loop = (node, width) => {
|
||||||
|
if (withGeneralization && node.checkHasGeneralization()) {
|
||||||
|
totalGeneralizationNodeWidth += node._generalizationNodeWidth
|
||||||
|
}
|
||||||
if (node.children.length) {
|
if (node.children.length) {
|
||||||
width += node.width / 2
|
width += node.width / 2
|
||||||
node.children.forEach(item => {
|
node.children.forEach(item => {
|
||||||
@ -216,7 +220,7 @@ class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
loop(node, 0)
|
loop(node, 0)
|
||||||
return Math.max(...widthArr)
|
return Math.max(...widthArr) + totalGeneralizationNodeWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
// 二次贝塞尔曲线
|
// 二次贝塞尔曲线
|
||||||
|
|||||||
@ -87,11 +87,11 @@ class CatalogOrganization extends Base {
|
|||||||
totalLeft += cur.width + marginX
|
totalLeft += cur.width + marginX
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let totalTop = node.top + node.height + marginY + (this.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0)
|
let totalTop = node.top + this.getNodeHeightWithGeneralization(node) + marginY + (this.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0)
|
||||||
node.children.forEach(cur => {
|
node.children.forEach(cur => {
|
||||||
cur.left = node.left + node.width * 0.5
|
cur.left = node.left + node.width * 0.5
|
||||||
cur.top = totalTop
|
cur.top = totalTop
|
||||||
totalTop += cur.height + marginY + (this.getNodeActChildrenLength(cur) > 0 ? cur.expandBtnSize : 0)
|
totalTop += this.getNodeHeightWithGeneralization(cur) + marginY + (this.getNodeActChildrenLength(cur) > 0 ? cur.expandBtnSize : 0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ class CatalogOrganization extends Base {
|
|||||||
}
|
}
|
||||||
// 调整left
|
// 调整left
|
||||||
if (parent && parent.isRoot) {
|
if (parent && parent.isRoot) {
|
||||||
let areaWidth = this.getNodeAreaWidth(node)
|
let areaWidth = this.getNodeAreaWidth(node, true)
|
||||||
let difference = areaWidth - node.width
|
let difference = areaWidth - node.width
|
||||||
if (difference > 0) {
|
if (difference > 0) {
|
||||||
this.updateBrothersLeft(node, difference)
|
this.updateBrothersLeft(node, difference)
|
||||||
@ -124,7 +124,7 @@ class CatalogOrganization extends Base {
|
|||||||
let marginY = this.getMarginY(layerIndex + 1)
|
let marginY = this.getMarginY(layerIndex + 1)
|
||||||
let totalHeight =
|
let totalHeight =
|
||||||
node.children.reduce((h, item) => {
|
node.children.reduce((h, item) => {
|
||||||
return h + item.height + (this.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0)
|
return h + this.getNodeHeightWithGeneralization(item) + (this.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0)
|
||||||
}, 0) +
|
}, 0) +
|
||||||
len * marginY
|
len * marginY
|
||||||
this.updateBrothersTop(node, totalHeight)
|
this.updateBrothersTop(node, totalHeight)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user