bpmn-js
Version:
A bpmn 2.0 toolkit and web modeler
24 lines (20 loc) • 625 B
JavaScript
import { getOrientation } from 'diagram-js/lib/layout/LayoutUtil';
/**
* @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL
* @typedef {import('diagram-js/lib/util/Types').Point} Point
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
*/
/**
* @param {Point} position
* @param {Rect} targetBounds
*
* @return {DirectionTRBL|null}
*/
export function getBoundaryAttachment(position, targetBounds) {
var orientation = getOrientation(position, targetBounds, -15);
if (orientation !== 'intersect') {
return orientation;
} else {
return null;
}
}