bbox.js 735 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.bbox = void 0;
  4. const util_1 = require("./util");
  5. /**
  6. * Places the connection point at the intersection between the edge
  7. * path end segment and the target node bbox.
  8. */
  9. const bbox = function (line, view, magnet, options) {
  10. const bbox = view.getBBoxOfElement(magnet);
  11. if (options.stroked) {
  12. bbox.inflate((0, util_1.getStrokeWidth)(magnet) / 2);
  13. }
  14. const intersections = line.intersect(bbox);
  15. const p = intersections && intersections.length
  16. ? line.start.closest(intersections)
  17. : line.end;
  18. return (0, util_1.offset)(p, line.start, options.offset);
  19. };
  20. exports.bbox = bbox;
  21. //# sourceMappingURL=bbox.js.map