position property

Vector2 get position

Implementation

Vector2 get position {
  if (end == start) {
    return start.position + Vector2(start.radiusZoom, 0);
  }
  var e = end!.position;
  var s = start.position;
  var distance = Util.distance(s, e);
  var c = (s + e) / 2;
  var dcy = s.y - c.y;
  var dcx = c.x - s.x;

  var edgesBetweenTwoVertex = cpn?.graph.edgesFromTwoVertex(start, end) ?? [];
  var nl = computeIndex * distance / edgesBetweenTwoVertex.length;
  var nx = dcy / (distance / 2) * nl;
  var ny = dcx / (distance / 2) * nl;
  var n = c + Vector2(nx, ny);
  return n;
}