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

Function apportion

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

Source from the content-addressed store, hash-verified

5820 }
5821 }
5822 function apportion(node, previousSibling, ancestor) {
5823 if (previousSibling) {
5824 var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
5825 while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
5826 vom = d3_layout_treeLeft(vom);
5827 vop = d3_layout_treeRight(vop);
5828 vop._tree.ancestor = node;
5829 shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
5830 if (shift > 0) {
5831 d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
5832 sip += shift;
5833 sop += shift;
5834 }
5835 sim += vim._tree.mod;
5836 sip += vip._tree.mod;
5837 som += vom._tree.mod;
5838 sop += vop._tree.mod;
5839 }
5840 if (vim && !d3_layout_treeRight(vop)) {
5841 vop._tree.thread = vim;
5842 vop._tree.mod += sim - sop;
5843 }
5844 if (vip && !d3_layout_treeLeft(vom)) {
5845 vom._tree.thread = vip;
5846 vom._tree.mod += sip - som;
5847 ancestor = node;
5848 }
5849 }
5850 return ancestor;
5851 }
5852 d3_layout_treeVisitAfter(root, function(node, previousSibling) {
5853 node._tree = {
5854 ancestor: node,

Callers 1

firstWalkFunction · 0.85

Calls 4

d3_layout_treeRightFunction · 0.85
d3_layout_treeLeftFunction · 0.85
d3_layout_treeMoveFunction · 0.85
d3_layout_treeAncestorFunction · 0.85

Tested by

no test coverage detected