MCPcopy Create free account
hub / github.com/idank/explainshell / firstWalk

Function firstWalk

explainshell/web/static/js/d3.v3.js:5787–5810  ·  view source on GitHub ↗
(node, previousSibling)

Source from the content-addressed store, hash-verified

5785 function tree(d, i) {
5786 var nodes = hierarchy.call(this, d, i), root = nodes[0];
5787 function firstWalk(node, previousSibling) {
5788 var children = node.children, layout = node._tree;
5789 if (children && (n = children.length)) {
5790 var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
5791 while (++i < n) {
5792 child = children[i];
5793 firstWalk(child, previousChild);
5794 ancestor = apportion(child, previousChild, ancestor);
5795 previousChild = child;
5796 }
5797 d3_layout_treeShift(node);
5798 var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
5799 if (previousSibling) {
5800 layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5801 layout.mod = layout.prelim - midpoint;
5802 } else {
5803 layout.prelim = midpoint;
5804 }
5805 } else {
5806 if (previousSibling) {
5807 layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5808 }
5809 }
5810 }
5811 function secondWalk(node, x) {
5812 node.x = node._tree.prelim + x;
5813 var children = node.children;

Callers 1

treeFunction · 0.85

Calls 2

apportionFunction · 0.85
d3_layout_treeShiftFunction · 0.85

Tested by

no test coverage detected