summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/assets/javascripts/branch-graph.js36
1 files changed, 29 insertions, 7 deletions
diff --git a/vendor/assets/javascripts/branch-graph.js b/vendor/assets/javascripts/branch-graph.js
index 2fc39423b41..4ca8680416b 100644
--- a/vendor/assets/javascripts/branch-graph.js
+++ b/vendor/assets/javascripts/branch-graph.js
@@ -73,7 +73,8 @@
, cumonth = ""
, offsetX = 20
, offsetY = 60
- , barWidth = Math.max(graphWidth, this.dayCount * 20 + 320);
+ , barWidth = Math.max(graphWidth, this.dayCount * 20 + 320)
+ , scrollLeft = cw;
this.raphael = r;
@@ -103,8 +104,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 +117,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 +132,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
@@ -145,12 +161,18 @@
if (this.commits[i].refs) {
this.appendLabel(x, y, this.commits[i].refs);
+
+ // The main branch is displayed in the center.
+ re = new RegExp('(^| )' + this.options.ref + '( |$)');
+ if (this.commits[i].refs.match(re)) {
+ scrollLeft = x - graphWidth / 2;
+ }
}
this.appendAnchor(top, this.commits[i], x, y);
}
top.toFront();
- this.element.scrollLeft(cw);
+ this.element.scrollLeft(scrollLeft);
this.bindEvents();
};