import { findNewLineStartIndex, getAnchorPointAdjustment } from './LayoutUtil'; import { getMid } from 'diagram-js/lib/layout/LayoutUtil'; /** * @typedef {import('./LineAttachmentUtil').Attachment} Attachment * * @typedef {import('./LayoutUtil').FindNewLintStartIndexHints} FindNewLintStartIndexHints */ /** * @param {Point[]} oldWaypoints * @param {Point[]} newWaypoints * @param {Attachment} attachment * @param {FindNewLintStartIndexHints} hints * * @return {number} */ export function findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hints) { return findNewLineStartIndex(oldWaypoints, newWaypoints, attachment, hints); } /** * Calculate the required adjustment (move delta) for the given label * after the connection waypoints got updated. * * @param {BpmnLabel} label * @param {Point[]} newWaypoints * @param {Point[]} oldWaypoints * @param {FindNewLintStartIndexHints} hints * * @return {Point} */ export function getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) { var labelPosition = getMid(label); return getAnchorPointAdjustment(labelPosition, newWaypoints, oldWaypoints, hints).delta; }