function repairConnection(source, target, start, end, waypoints, hints) {

  if (isArray(start)) {
    waypoints = start;
    hints = end;

    start = getMid(source);
    end = getMid(target);
  }

  hints = assign({ preferredLayouts: [] }, hints);
  waypoints = waypoints || [];

  var preferredLayouts = hints.preferredLayouts,
      preferStraight = preferredLayouts.indexOf('straight') !== -1,
      repairedWaypoints;

  // just layout non-existing or simple connections
  // attempt to render straight lines, if required

  // attempt to layout a straight line
  repairedWaypoints = preferStraight && tryLayoutStraight(source, target, start, end, hints);

  if (repairedWaypoints) {
    return repairedWaypoints;
  }

  // try to layout from end
  repairedWaypoints = hints.connectionEnd && tryRepairConnectionEnd(target, source, end, waypoints);

  if (repairedWaypoints) {
    return repairedWaypoints;
  }

  // try to layout from start
  repairedWaypoints = hints.connectionStart && tryRepairConnectionStart(source, target, start, waypoints);

  if (repairedWaypoints) {
    return repairedWaypoints;
  }

  // or whether nothing seems to have changed
  if (!hints.connectionStart && !hints.connectionEnd && waypoints && waypoints.length) {
    return waypoints;
  }

  // simply reconnect if nothing else worked
  return connectRectangles(source, target, start, end, hints);
}
/**
 * Repair the connection between two rectangles, of which one has been updated.
 *
 * @param {Bounds} source
 * @param {Bounds} target
 * @param {Point} [start]
 * @param {Point} [end]
 * @param {Array<Point>} [waypoints]
 * @param {Object} [hints]
 * @param {Array<string>} [hints.preferredLayouts] list of preferred layouts
 * @param {boolean} [hints.connectionStart]
 * @param {boolean} [hints.connectionEnd]
 *
 * @return {Array<Point>} repaired waypoints
 */
Repair the connection between two rectangles, of which one has been updated.

@return {Array} repaired waypoints
Repair the connection between two rectangles of which one has been updated . @return { Array } repaired waypoints
function repairConnection(source, target, start, end, waypoints, hints) {
  if (isArray(start)) {
    waypoints = start;
    hints = end;
    start = getMid(source);
    end = getMid(target);
  }
  hints = assign({ preferredLayouts: [] }, hints);
  waypoints = waypoints || [];
  var preferredLayouts = hints.preferredLayouts,
      preferStraight = preferredLayouts.indexOf('straight') !== -1,
      repairedWaypoints;
  repairedWaypoints = preferStraight && tryLayoutStraight(source, target, start, end, hints);
  if (repairedWaypoints) {
    return repairedWaypoints;
  }
  repairedWaypoints = hints.connectionEnd && tryRepairConnectionEnd(target, source, end, waypoints);
  if (repairedWaypoints) {
    return repairedWaypoints;
  }
  repairedWaypoints = hints.connectionStart && tryRepairConnectionStart(source, target, start, waypoints);
  if (repairedWaypoints) {
    return repairedWaypoints;
  }
  if (!hints.connectionStart && !hints.connectionEnd && waypoints && waypoints.length) {
    return waypoints;
  }
  return connectRectangles(source, target, start, end, hints);
}
function repairConnection ( source , target , start , end , waypoints , hints ) { if ( isArray ( start ) ) { waypoints = start ; hints = end ; start = getMid ( source ) ; end = getMid ( target ) ; } hints = assign ( { preferredLayouts : [ ] } , hints ) ; waypoints = waypoints || [ ] ; var preferredLayouts = hints . preferredLayouts , preferStraight = preferredLayouts . indexOf ( 'straight' ) !== - 1 , repairedWaypoints ; repairedWaypoints = preferStraight && tryLayoutStraight ( source , target , start , end , hints ) ; if ( repairedWaypoints ) { return repairedWaypoints ; } repairedWaypoints = hints . connectionEnd && tryRepairConnectionEnd ( target , source , end , waypoints ) ; if ( repairedWaypoints ) { return repairedWaypoints ; } repairedWaypoints = hints . connectionStart && tryRepairConnectionStart ( source , target , start , waypoints ) ; if ( repairedWaypoints ) { return repairedWaypoints ; } if ( ! hints . connectionStart && ! hints . connectionEnd && waypoints && waypoints . length ) { return waypoints ; } return connectRectangles ( source , target , start , end , hints ) ; }
Repair the connection between two rectangles, of which one has been updated.
Repair the connection between two rectangles of which one has been updated .
// just layout non-existing or simple connections // attempt to render straight lines, if required // attempt to layout a straight line // try to layout from end // try to layout from start // or whether nothing seems to have changed // simply reconnect if nothing else worked