align.js 771 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.center = exports.justify = exports.right = exports.left = void 0;
  4. const d3_array_1 = require("d3-array");
  5. function targetDepth(d) {
  6. return d.target.depth;
  7. }
  8. function left(node) {
  9. return node.depth;
  10. }
  11. exports.left = left;
  12. function right(node, n) {
  13. return n - 1 - node.height;
  14. }
  15. exports.right = right;
  16. function justify(node, n) {
  17. return node.sourceLinks.length ? node.depth : n - 1;
  18. }
  19. exports.justify = justify;
  20. function center(node) {
  21. return node.targetLinks.length
  22. ? node.depth
  23. : node.sourceLinks.length
  24. ? (0, d3_array_1.min)(node.sourceLinks, targetDepth) - 1
  25. : 0;
  26. }
  27. exports.center = center;
  28. //# sourceMappingURL=align.js.map