Skip to content

Commit

Permalink
Adjust arrow position and length
Browse files Browse the repository at this point in the history
  • Loading branch information
ifitzpatrick committed Jun 30, 2016
1 parent 119cf98 commit 1aee4c9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions the-graph/the-graph-edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@
return [x1, y1];
};

var arrowLength = 12;
// Which direction should arrow point
if (plus[0] > minus[0]) {
arrowLength *= -1;
}
center = findLinePoint(center[0], center[1], m, b, -1*arrowLength/2);

// find points of perpendicular line length l centered at x,y
var perpendicular = function (x, y, oldM, l) {
var m = -1/oldM;
Expand All @@ -247,12 +254,6 @@
return [point1, point2];
};

var arrowLength = 15;
// Which direction should arrow point
if (plus[0] > minus[0]) {
arrowLength *= -1;
}

var points = perpendicular(center[0], center[1], m, arrowLength * 0.9);
// For m === 0, figure out if arrow should be straight up or down
var flip = plus[1] > minus[1] ? -1 : 1;
Expand Down

0 comments on commit 1aee4c9

Please sign in to comment.