MCPcopy Create free account
hub / github.com/microsoft/SandDance / positionNode

Function positionNode

docs/tests/v2/es6/js/sanddance.js:121711–121728  ·  view source on GitHub ↗
(dy, n)

Source from the content-addressed store, hash-verified

121709 }
121710
121711 function positionNode(dy, n) {
121712 return function (node) {
121713 if (node.children) {
121714 (0, _dice.default)(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);
121715 }
121716
121717 var x0 = node.x0,
121718 y0 = node.y0,
121719 x1 = node.x1 - padding,
121720 y1 = node.y1 - padding;
121721 if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
121722 if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
121723 node.x0 = x0;
121724 node.y0 = y0;
121725 node.x1 = x1;
121726 node.y1 = y1;
121727 };
121728 }
121729
121730 partition.round = function (x) {
121731 return arguments.length ? (round = !!x, partition) : round;

Callers 1

partitionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected