I tried to implement the same example of wrapping circles and had overlapping circles. For me, the problem was that the parent data nodes had 0 children and size 0. As soon as I changed the parent nodes with an empty array of children to properly formatted leaves, the problem disappeared.
Bad overlap in front of the data structure:
root = {name:"root", children:[ {name:"badchildlessparent", children:[]}, {name:"parentnodewithchild", children:[{name:"a leaf",size=50}]} ] }
Perfect packaging after data structure:
root = {name:"root", children:[ {name:"fixedit_now_child", size=1} , {name:"parentnodewithchild", children:[{name:"a leaf",size=50}]} ] }
source share