Refactor: Removing a if statement, because the nil value is already removed in the view template.
This commit is contained in:
parent
b7e5f4556b
commit
c0d312bebe
1 changed files with 47 additions and 49 deletions
|
@ -118,58 +118,56 @@
|
||||||
for (var j = 0, jj = this.commits[i].parents.length; j < jj; j++) {
|
for (var j = 0, jj = this.commits[i].parents.length; j < jj; j++) {
|
||||||
c = this.preparedCommits[this.commits[i].parents[j][0]];
|
c = this.preparedCommits[this.commits[i].parents[j][0]];
|
||||||
ps = this.commits[i].parents[j][1];
|
ps = this.commits[i].parents[j][1];
|
||||||
if (c) {
|
var cx = offsetX + 20 * c.time
|
||||||
var cx = offsetX + 20 * c.time
|
, cy = offsetY + 10 * c.space
|
||||||
, cy = offsetY + 10 * c.space
|
, psy = offsetY + 10 * ps;
|
||||||
, psy = offsetY + 10 * ps;
|
if (c.space == this.commits[i].space && c.space == ps) {
|
||||||
if (c.space == this.commits[i].space && c.space == ps) {
|
r.path([
|
||||||
r.path([
|
"M", x, y,
|
||||||
"M", x, y,
|
"L", cx, cy
|
||||||
"L", cx, cy
|
]).attr({
|
||||||
]).attr({
|
stroke: this.colors[c.space],
|
||||||
stroke: this.colors[c.space],
|
"stroke-width": 2
|
||||||
"stroke-width": 2
|
});
|
||||||
});
|
|
||||||
|
|
||||||
} else if (c.space < this.commits[i].space) {
|
} else if (c.space < this.commits[i].space) {
|
||||||
if (y == psy) {
|
if (y == psy) {
|
||||||
r.path([
|
r.path([
|
||||||
"M", x - 5, y,
|
"M", x - 5, y,
|
||||||
"l-5,-2,0,4,5,-2",
|
"l-5,-2,0,4,5,-2",
|
||||||
"L", x - 10, y,
|
"L", x - 10, y,
|
||||||
"L", x - 15, psy,
|
"L", x - 15, psy,
|
||||||
"L", cx + 5, psy,
|
"L", cx + 5, psy,
|
||||||
"L", cx, cy])
|
"L", cx, cy])
|
||||||
.attr({
|
.attr({
|
||||||
stroke: this.colors[this.commits[i].space],
|
stroke: this.colors[this.commits[i].space],
|
||||||
"stroke-width": 2
|
"stroke-width": 2
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
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[this.commits[i].space],
|
|
||||||
"stroke-width": 2
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
r.path([
|
r.path([
|
||||||
"M", x - 3, y + 6,
|
"M", x - 3, y - 6,
|
||||||
"l-4,3,4,2,0,-5",
|
"l-4,-3,4,-2,0,5",
|
||||||
"L", x - 5, y + 10,
|
"L", x - 5, y - 10,
|
||||||
"L", x - 10, psy,
|
"L", x - 10, psy,
|
||||||
"L", cx + 5, psy,
|
"L", cx + 5, psy,
|
||||||
"L", cx, cy])
|
"L", cx, cy])
|
||||||
.attr({
|
.attr({
|
||||||
stroke: this.colors[c.space],
|
stroke: this.colors[this.commits[i].space],
|
||||||
"stroke-width": 2
|
"stroke-width": 2
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
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…
Reference in a new issue