BpmnSnappingUtil.js 602 B

123456789101112131415161718192021222324
  1. import { getOrientation } from 'diagram-js/lib/layout/LayoutUtil';
  2. /**
  3. * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL
  4. * @typedef {import('diagram-js/lib/util/Types').Point} Point
  5. * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
  6. */
  7. /**
  8. * @param {Point} position
  9. * @param {Rect} targetBounds
  10. *
  11. * @return {DirectionTRBL|null}
  12. */
  13. export function getBoundaryAttachment(position, targetBounds) {
  14. var orientation = getOrientation(position, targetBounds, -15);
  15. if (orientation !== 'intersect') {
  16. return orientation;
  17. } else {
  18. return null;
  19. }
  20. }