{"size": 1503, "ext": "js", "max_stars_repo_path": "modules/graphs/client/filters/edge-path.client.filter.js", "max_stars_repo_name": "x2y/visigraph", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "modules/graphs/client/filters/edge-path.client.filter.js", "max_issues_repo_name": "x2y/visigraph", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "modules/graphs/client/filters/edge-path.client.filter.js", "max_forks_repo_name": "x2y/visigraph", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.8333333333, "max_line_length": 96, "alphanum_fraction": 0.4664005323}
'use strict';

angular.module('graphs').filter('edgePath', function() {
  return function(edge) {
    if (edge.isLinear) {
      return [
        'M',  // Absolute move command.
        edge.from.x,
        edge.from.y,
        edge.to.x,
        edge.to.y,
      ].join(' ');
    } else if (edge.from === edge.to) {
      // Unfortunately SVG arc commands only work for angles < 2π, so to draw a full circle, one
      // needs to use two separate arc commands.
      return [
        'M',  // Absolute move command.
        edge.from.x,
        edge.from.y,
        'A',  // Absolute arc command.
        edge._radius,  // rx.
        edge._radius,  // ry.
        0,  // x-axis-rotation.
        1,  // large-arc-flag.
        1,  // sweep-flag.
        edge.handle.x,  // x.
        edge.handle.y,  // y.
        'A',  // Absolute arc command.
        edge._radius,  // rx.
        edge._radius,  // ry.
        0,  // x-axis-rotation.
        1,  // large-arc-flag.
        1,  // sweep-flag.
        edge.to.x,  // x.
        edge.to.y,  // y.
      ].join(' ');
    } else {
      return [
        'M',  // Absolute move command.
        edge.from.x,
        edge.from.y,
        'A',  // Absolute arc command.
        edge._radius,  // rx.
        edge._radius,  // ry.
        0,  // x-axis-rotation.
        edge._isLargeArc ? 1 : 0,  // large-arc-flag.
        edge._isPositiveArc ? 1 : 0,  // sweep-flag.
        edge.to.x,  // x.
        edge.to.y,  // y.
      ].join(' ');
    }
  };
});
