align.js 725 B

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.center = exports.justify = exports.right = exports.left = void 0;
  4. var util_1 = require("@antv/util");
  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 ? node.depth : node.sourceLinks.length ? (0, util_1.minBy)(node.sourceLinks, targetDepth) - 1 : 0;
  22. }
  23. exports.center = center;
  24. //# sourceMappingURL=align.js.map