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 @@
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].parents[j][1];
if (c) {
var cx = offsetX + 20 * c.time
, cy = offsetY + 10 * c.space
, psy = offsetY + 10 * ps;
if (c.space == this.commits[i].space && c.space == ps) {
r.path([
"M", x, y,
"L", cx, cy
]).attr({
stroke: this.colors[c.space],
"stroke-width": 2
});
var cx = offsetX + 20 * c.time
, cy = offsetY + 10 * c.space
, psy = offsetY + 10 * ps;
if (c.space == this.commits[i].space && c.space == ps) {
r.path([
"M", x, y,
"L", cx, cy
]).attr({
stroke: this.colors[c.space],
"stroke-width": 2
});
} else if (c.space < this.commits[i].space) {
if (y == psy) {
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,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 if (c.space < this.commits[i].space) {
if (y == psy) {
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,-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
});
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 {
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