Describe the bug
In cases where no nodes list is supplied and the root node is used, the fit function doesn't take the root node's location into account along with its descendants. It doesn't distinguish between expanded and unexpanded nodes.
The bug is in the line that defines the descendants.
Currently...
let descendants = nodes ? nodes : root.descendants();
Describe the bug In cases where no nodes list is supplied and the root node is used, the fit function doesn't take the root node's location into account along with its descendants. It doesn't distinguish between expanded and unexpanded nodes.
The bug is in the line that defines the descendants.
Currently...
let descendants = nodes ? nodes : root.descendants();
...and what I think it should be...
const descendants = nodes ? nodes : [root].concat(root.descendants().filter(d => d.data._expanded === true));