From 525a8cd3e96b7bae0acda8b6e94df529fa06ff6a Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Tue, 29 Jan 2013 17:25:17 +0900 Subject: Switchable the main branch on network graph --- vendor/assets/javascripts/branch-graph.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'vendor') diff --git a/vendor/assets/javascripts/branch-graph.js b/vendor/assets/javascripts/branch-graph.js index 93849c79e80..cdaa8dd8d37 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; @@ -145,12 +146,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(); }; -- cgit v1.2.3