Improve overlap of lines in network graph
This commit is contained in:
parent
7ba4f2dcfa
commit
59b6de93ce
3 changed files with 91 additions and 26 deletions
25
vendor/assets/javascripts/branch-graph.js
vendored
25
vendor/assets/javascripts/branch-graph.js
vendored
|
@ -103,8 +103,9 @@
|
|||
|
||||
for (i = 0; i < this.commitCount; i++) {
|
||||
var x = offsetX + 20 * this.commits[i].time
|
||||
, y = offsetY + 20 * this.commits[i].space
|
||||
, c;
|
||||
, y = offsetY + 10 * this.commits[i].space
|
||||
, c
|
||||
, ps;
|
||||
|
||||
// Draw dot
|
||||
r.circle(x, y, 3).attr({
|
||||
|
@ -115,9 +116,11 @@
|
|||
// Draw lines
|
||||
for (var j = 0, jj = this.commits[i].parents.length; j < jj; j++) {
|
||||
c = this.preparedCommits[this.commits[i].parents[j][0]];
|
||||
ps = this.commits[i].parent_spaces[j];
|
||||
if (c) {
|
||||
var cx = offsetX + 20 * c.time
|
||||
, cy = offsetY + 20 * c.space;
|
||||
, cy = offsetY + 10 * c.space
|
||||
, psy = offsetY + 10 * ps;
|
||||
if (c.space == this.commits[i].space) {
|
||||
r.path([
|
||||
"M", x, y,
|
||||
|
@ -128,13 +131,25 @@
|
|||
});
|
||||
|
||||
} else if (c.space < this.commits[i].space) {
|
||||
r.path(["M", x - 5, y + .0001, "l-5-2,0,4,5,-2C", x - 5, y, x - 17, y + 2, x - 20, y - 5, "L", cx, y - 5, cx, cy])
|
||||
r.path([
|
||||
"M", x - 5, y,
|
||||
"l-5-2,0,4,5,-2",
|
||||
"L", x - 10, y,
|
||||
"L", x - 15, psy,
|
||||
"L", cx + 5, psy,
|
||||
"L", cx, cy])
|
||||
.attr({
|
||||
stroke: this.colors[this.commits[i].space],
|
||||
"stroke-width": 2
|
||||
});
|
||||
} else {
|
||||
r.path(["M", x - 3, y + 6, "l-4,3,4,2,0,-5L", x - 10, y + 20, "L", x - 10, cy, cx, cy])
|
||||
r.path([
|
||||
"M", x - 3, y + 6,
|
||||
"l-4,3,4,2,0,-5",
|
||||
"L", x - 5, y + 10,
|
||||
"L", x - 10, psy,
|
||||
"L", cx + 5, psy,
|
||||
"L", cx, cy])
|
||||
.attr({
|
||||
stroke: this.colors[c.space],
|
||||
"stroke-width": 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue