diff options
author | Sato Hiroyuki <sathiroyuki@gmail.com> | 2013-01-29 12:25:17 +0400 |
---|---|---|
committer | Sato Hiroyuki <sathiroyuki@gmail.com> | 2013-01-30 04:12:03 +0400 |
commit | 525a8cd3e96b7bae0acda8b6e94df529fa06ff6a (patch) | |
tree | dbfda7c6ee03274470c2176c7c19dc396fc4ac5a /vendor/assets/javascripts | |
parent | c84675ee06dfc72c46c178ef40e30f03053dcc5a (diff) |
Switchable the main branch on network graph
Diffstat (limited to 'vendor/assets/javascripts')
-rw-r--r-- | vendor/assets/javascripts/branch-graph.js | 11 |
1 files changed, 9 insertions, 2 deletions
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(); }; |