|
1 | 1 | /* ==========================================================
|
2 |
| - * GitGraph v1.1.0 |
| 2 | + * GitGraph v1.1.1 |
3 | 3 | * https://github.com/nicoespeon/gitgraph.js
|
4 | 4 | * ==========================================================
|
5 |
| - * Copyright (c) 2015 Nicolas CARLO (@nicoespeon) ٩(^‿^)۶ |
6 |
| - * Copyright (c) 2015 Fabien BERNARD (@fabien0102) ✌(✰‿✰)✌ |
| 5 | + * Copyright (c) 2016 Nicolas CARLO (@nicoespeon) ٩(^‿^)۶ |
| 6 | + * Copyright (c) 2016 Fabien BERNARD (@fabien0102) ✌(✰‿✰)✌ |
7 | 7 | *
|
8 | 8 | * GitGraph.js may be freely distributed under the MIT Licence
|
9 | 9 | * ========================================================== */
|
|
134 | 134 |
|
135 | 135 | // Navigation vars
|
136 | 136 | this.HEAD = null;
|
137 |
| - this.branchs = []; |
| 137 | + this.branches = []; |
138 | 138 | this.commits = [];
|
139 | 139 |
|
140 | 140 | // Utilities
|
|
183 | 183 |
|
184 | 184 | // Add branch
|
185 | 185 | var branch = new Branch( options );
|
186 |
| - this.branchs.push( branch ); |
| 186 | + this.branches.push( branch ); |
187 | 187 |
|
188 | 188 | // Return
|
189 | 189 | return branch;
|
|
212 | 212 |
|
213 | 213 | // Add branch
|
214 | 214 | var branch = new Branch( options );
|
215 |
| - this.branchs.push( branch ); |
| 215 | + this.branches.push( branch ); |
216 | 216 |
|
217 | 217 | // Return
|
218 | 218 | return branch;
|
|
311 | 311 | this.offsetX = this.canvas.width - this.marginX * 2;
|
312 | 312 | }
|
313 | 313 |
|
314 |
| - // Render branchs |
315 |
| - for ( var i = this.branchs.length - 1, branch; !!(branch = this.branchs[ i ]); i-- ) { |
| 314 | + // Render branches |
| 315 | + for ( var i = this.branches.length - 1, branch; !!(branch = this.branches[ i ]); i-- ) { |
316 | 316 | branch.render();
|
317 | 317 | }
|
318 | 318 |
|
|
414 | 414 | }
|
415 | 415 | };
|
416 | 416 |
|
417 |
| - |
418 | 417 | /**
|
419 | 418 | * Click event on commit dot
|
420 | 419 | *
|
|
519 | 518 |
|
520 | 519 | // Add branch
|
521 | 520 | var branch = new Branch( options );
|
522 |
| - this.parent.branchs.push( branch ); |
| 521 | + this.parent.branches.push( branch ); |
523 | 522 |
|
524 | 523 | // Return
|
525 | 524 | return branch;
|
|
769 | 768 | **/
|
770 | 769 | Branch.prototype.calculColumn = function () {
|
771 | 770 | var candidates = [];
|
772 |
| - for ( var i = 0, branch; !!(branch = this.parent.branchs[ i ]); i++ ) { |
| 771 | + for ( var i = 0, branch; !!(branch = this.parent.branches[ i ]); i++ ) { |
773 | 772 | if ( !branch.isfinish ) {
|
774 | 773 | if ( !( branch.column in candidates ) ) {
|
775 | 774 | candidates[ branch.column ] = 0;
|
|
897 | 896 | this.arrow();
|
898 | 897 | }
|
899 | 898 |
|
900 |
| - // Detail |
901 |
| - if ( this.detail !== null ) { |
902 |
| - this.detail.style.left = this.parent.canvas.offsetLeft + (this.parent.columnMax + 1) * this.template.branch.spacingX + 30 + "px"; |
903 |
| - this.detail.style.top = this.parent.canvas.offsetTop + this.y + 40 + "px"; |
904 |
| - this.detail.width = 30; |
905 |
| - } |
906 |
| - |
907 | 899 | this.context.font = this.messageFont;
|
908 | 900 |
|
909 | 901 | // Tag
|
|
926 | 918 | tagWidth = (tagWidth < textWidth) ? textWidth : tagWidth;
|
927 | 919 | }
|
928 | 920 |
|
| 921 | + var commitOffsetLeft = (this.parent.columnMax + 1) * this.template.branch.spacingX + tagWidth; |
| 922 | + |
| 923 | + // Detail |
| 924 | + if ( this.detail !== null ) { |
| 925 | + this.detail.style.left = this.parent.canvas.offsetLeft + commitOffsetLeft + this.x + 30 + "px"; |
| 926 | + this.detail.style.top = this.parent.canvas.offsetTop + this.y + 40 + "px"; |
| 927 | + this.detail.width = 30; |
| 928 | + } |
| 929 | + |
929 | 930 | // Message
|
930 | 931 | if ( this.messageDisplay ) {
|
931 | 932 | var message = this.message;
|
|
940 | 941 | }
|
941 | 942 |
|
942 | 943 | this.context.fillStyle = this.messageColor;
|
943 |
| - this.context.fillText( message, ((this.parent.columnMax + 1) * this.template.branch.spacingX) + tagWidth, this.y + this.dotSize/2); |
| 944 | + this.context.fillText( message, commitOffsetLeft, this.y + this.dotSize / 2); |
944 | 945 | }
|
945 | 946 | };
|
946 | 947 |
|
|
1014 | 1015 | * @param {String} [options.branch.color] - Branch color
|
1015 | 1016 | * @param {Number} [options.branch.linewidth] - Branch line width
|
1016 | 1017 | * @param {String} [options.branch.mergeStyle = ("bezier"|"straight")] - Branch merge style
|
1017 |
| - * @param {Number} [options.branch.spacingX] - Space between branchs |
1018 |
| - * @param {Number} [options.branch.spacingY] - Space between branchs |
| 1018 | + * @param {Number} [options.branch.spacingX] - Space between branches |
| 1019 | + * @param {Number} [options.branch.spacingY] - Space between branches |
1019 | 1020 | * @param {Number} [options.commit.spacingX] - Space between commits
|
1020 | 1021 | * @param {Number} [options.commit.spacingY] - Space between commits
|
1021 | 1022 | * @param {Number} [options.commit.widthExtension = 0] - Additional width to be added to the calculated width
|
|
1060 | 1061 | // Merge style = "bezier" | "straight"
|
1061 | 1062 | this.branch.mergeStyle = options.branch.mergeStyle || "bezier";
|
1062 | 1063 |
|
1063 |
| - // Space between branchs |
| 1064 | + // Space between branches |
1064 | 1065 | this.branch.spacingX = (typeof options.branch.spacingX === "number") ? options.branch.spacingX : 20;
|
1065 | 1066 | this.branch.spacingY = options.branch.spacingY || 0;
|
1066 | 1067 |
|
|
0 commit comments