You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
915 B
33 lines
915 B
import { findNewLineStartIndex, getAnchorPointAdjustment } from './LayoutUtil'; |
|
|
|
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 {djs.model.Label} label |
|
* @param {Array<Point>} newWaypoints |
|
* @param {Array<Point>} oldWaypoints |
|
* @param {Object} hints |
|
* |
|
* @return {Point} delta |
|
*/ |
|
export function getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) { |
|
var labelPosition = getLabelMid(label); |
|
|
|
return getAnchorPointAdjustment(labelPosition, newWaypoints, oldWaypoints, hints).delta; |
|
} |
|
|
|
|
|
// HELPERS ////////////////////// |
|
|
|
function getLabelMid(label) { |
|
return { |
|
x: label.x + label.width / 2, |
|
y: label.y + label.height / 2 |
|
}; |
|
}
|
|
|