Commit c0d312be authored by Sato Hiroyuki's avatar Sato Hiroyuki

Refactor: Removing a if statement, because the nil value is already removed in the view template.

parent b7e5f455
...@@ -118,58 +118,56 @@ ...@@ -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
});
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment