All files / core/domain/utils/geometry getSelfLoopControlPoints.js

0% Statements 0/1
100% Branches 0/0
0% Functions 0/1
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                                     
/**
 * Return the coordinates of the two control points for a self loop (i.e.
 * where the start point is also the end point) computed as a cubic bezier
 * curve.
 *
 * @param  {number} x    The X coordinate of the node.
 * @param  {number} y    The Y coordinate of the node.
 * @param  {number} size The node size.
 * @return {x1,y1,x2,y2} The coordinates of the two control points.
 */
export default function getSelfLoopControlPoints(x, y, size) {
  return {
    x1: x - size * 7,
    y1: y,
    x2: x,
    y2: y + size * 7
  };
}