Fix tree branch overlap (#7641)
This commit is contained in:
@@ -26,7 +26,7 @@ public class BranchTreeLayout implements TreeLayout{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float getWidthOrHeightOfNode(TreeNode treeNode, boolean returnWidth){
|
private float getWidthOrHeightOfNode(TreeNode treeNode, boolean returnWidth){
|
||||||
return returnWidth ? treeNode.width : treeNode.height;
|
return returnWidth ? treeNode.calcWidth() : treeNode.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getNodeThickness(TreeNode treeNode){
|
private float getNodeThickness(TreeNode treeNode){
|
||||||
|
|||||||
@@ -18,5 +18,15 @@ public interface TreeLayout{
|
|||||||
public boolean isLeaf(){
|
public boolean isLeaf(){
|
||||||
return children == null || children.length == 0;
|
return children == null || children.length == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float calcWidth(){
|
||||||
|
if(children == null) return width;
|
||||||
|
|
||||||
|
float cWidth = 0;
|
||||||
|
for(T node : children){
|
||||||
|
cWidth += node.calcWidth();
|
||||||
|
}
|
||||||
|
return Math.max(width, cWidth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user