lib/layout/ManhattanLayout.js
function getSimpleBendpoints(a, b, directions) {

  var xmid = round((b.x - a.x) / 2 + a.x),
      ymid = round((b.y - a.y) / 2 + a.y);

  // one point, right or left from a
  if (directions === 'h:v') {
    return [ { x: b.x, y: a.y } ];
  }

  // one point, above or below a
  if (directions === 'v:h') {
    return [ { x: a.x, y: b.y } ];
  }

  // vertical segment between a and b
  if (directions === 'h:h') {
    return [
      { x: xmid, y: a.y },
      { x: xmid, y: b.y }
    ];
  }

  // horizontal segment between a and b
  if (directions === 'v:v') {
    return [
      { x: a.x, y: ymid },
      { x: b.x, y: ymid }
    ];
  }

  throw new Error('invalid directions: can only handle varians of [hv]:[hv]');
}
function getSimpleBendpoints(a, b, directions) {

  var xmid = round((b.x - a.x) / 2 + a.x),
      ymid = round((b.y - a.y) / 2 + a.y);

  // one point, right or left from a
  if (directions === 'h:v') {
    return [ { x: b.x, y: a.y } ];
  }

  // one point, above or below a
  if (directions === 'v:h') {
    return [ { x: a.x, y: b.y } ];
  }

  // vertical segment between a and b
  if (directions === 'h:h') {
    return [
      { x: xmid, y: a.y },
      { x: xmid, y: b.y }
    ];
  }

  // horizontal segment between a and b
  if (directions === 'v:v') {
    return [
      { x: a.x, y: ymid },
      { x: b.x, y: ymid }
    ];
  }

  throw new Error('invalid directions: can only handle varians of [hv]:[hv]');
}
function getSimpleBendpoints ( a , b , directions ) { var xmid = round ( ( b . x - a . x ) / 2 + a . x ) , ymid = round ( ( b . y - a . y ) / 2 + a . y ) ; // one point, right or left from a if ( directions === 'h:v' ) { return [ { x : b . x , y : a . y } ] ; } // one point, above or below a if ( directions === 'v:h' ) { return [ { x : a . x , y : b . y } ] ; } // vertical segment between a and b if ( directions === 'h:h' ) { return [ { x : xmid , y : a . y } , { x : xmid , y : b . y } ] ; } // horizontal segment between a and b if ( directions === 'v:v' ) { return [ { x : a . x , y : ymid } , { x : b . x , y : ymid } ] ; } throw new Error ( 'invalid directions: can only handle varians of [hv]:[hv]' ) ; }
Handle simple layouts with maximum two bendpoints.
Handle simple layouts with maximum two bendpoints .