|
462 | 462 | * @param {Branch} [options.parentBranch = options.parentCommit.branch] - Parent branch
|
463 | 463 | * @param {Commit} [options.parentCommit = _getLast(options.parentBranch.commits)] - Parent commit
|
464 | 464 | * @param {string} [options.name = "no-name"] - Branch name
|
| 465 | + * @param {number[]} [options.lineDash = this.template.branch.lineDash] - Branch line dash segments |
465 | 466 | * @param {object} [options.commitDefaultOptions = {}] - Default options for commits
|
466 | 467 | *
|
467 | 468 | * @this Branch
|
|
605 | 606 | this.context.lineWidth = this.lineWidth;
|
606 | 607 | this.context.strokeStyle = this.color;
|
607 | 608 |
|
608 |
| - var prevLineDash; |
609 |
| - if (this.context.setLineDash !== undefined) { |
610 |
| - prevLineDash = this.context.getLineDash(); |
| 609 | + if (typeof this.context.setLineDash === "function") { |
611 | 610 | this.context.setLineDash(this.lineDash);
|
612 | 611 | }
|
613 | 612 |
|
614 | 613 | this.context.stroke();
|
615 | 614 | this.context.closePath();
|
616 |
| - |
617 |
| - //Restore previous line dash setting, if any |
618 |
| - if (prevLineDash !== undefined) { |
619 |
| - this.context.setLineDash(prevLineDash); |
620 |
| - } |
621 | 615 | };
|
622 | 616 |
|
623 | 617 | /**
|
|
1049 | 1043 | * @param {number} [options.dotSize = this.template.commit.dot.size] - Dot size
|
1050 | 1044 | * @param {number} [options.dotStrokeWidth = this.template.commit.dot.strokeWidth] - Dot stroke width
|
1051 | 1045 | * @param {string} [options.dotStrokeColor = this.template.commit.dot.strokeColor]
|
| 1046 | + * @param {number[]} [options.lineDash = this.template.commit.dot.lineDash] |
1052 | 1047 | *
|
1053 | 1048 | * @param {string} [options.message = "He doesn't like George Michael! Boooo!"] - Commit message
|
1054 | 1049 | * @param {string} [options.messageColor = options.color] - Specific message color
|
|
1095 | 1090 | this.dotSize = options.dotSize || this.template.commit.dot.size;
|
1096 | 1091 | this.dotStrokeWidth = options.dotStrokeWidth || this.template.commit.dot.strokeWidth;
|
1097 | 1092 | this.dotStrokeColor = options.dotStrokeColor || this.template.commit.dot.strokeColor || options.color;
|
| 1093 | + this.lineDash = options.lineDash || this.template.commit.dot.lineDash; |
1098 | 1094 | this.type = options.type || null;
|
1099 | 1095 | this.tooltipDisplay = _booleanOptionOr(options.tooltipDisplay, true);
|
1100 | 1096 | this.onClick = options.onClick || null;
|
|
1121 | 1117 |
|
1122 | 1118 | // Label
|
1123 | 1119 | if (this.showLabel) {
|
1124 |
| - |
1125 | 1120 | /*
|
1126 | 1121 | * For cases where we want a 0 or 180 degree label rotation in horizontal mode,
|
1127 | 1122 | * we need to modify the position of the label to sit centrally above the commit dot.
|
|
1161 | 1156 | this.context.strokeStyle = this.dotStrokeColor;
|
1162 | 1157 | this.context.lineWidth = this.dotStrokeWidth;
|
1163 | 1158 |
|
1164 |
| - if (typeof (this.dotStrokeWidth) === "number") { |
| 1159 | + if (typeof this.context.setLineDash === "function") { |
| 1160 | + this.context.setLineDash(this.lineDash); |
| 1161 | + } |
| 1162 | + |
| 1163 | + if (typeof this.dotStrokeWidth === "number") { |
1165 | 1164 | this.context.stroke();
|
1166 | 1165 | }
|
1167 | 1166 |
|
|
1362 | 1361 | * @param {number} [options.arrow.offset] - Arrow offset
|
1363 | 1362 | * @param {string} [options.branch.color] - Branch color
|
1364 | 1363 | * @param {number} [options.branch.lineWidth] - Branch line width
|
| 1364 | + * @param {number[]} [options.branch.lineDash] - Branch line dash segments |
1365 | 1365 | * @param {string} [options.branch.mergeStyle = ("bezier"|"straight")] - Branch merge style
|
1366 | 1366 | * @param {number} [options.branch.spacingX] - Space between branches
|
1367 | 1367 | * @param {number} [options.branch.spacingY] - Space between branches
|
|
1373 | 1373 | * @param {number} [options.commit.dot.size] - Commit dot size
|
1374 | 1374 | * @param {number} [options.commit.dot.strokeWidth] - Commit dot stroke width
|
1375 | 1375 | * @param {string} [options.commit.dot.strokeColor] - Commit dot stroke color
|
| 1376 | + * @param {number[]} [options.commit.dot.lineDash] - Commit dot line dash segments |
1376 | 1377 | * @param {string} [options.commit.message.color] - Commit message color
|
1377 | 1378 | * @param {boolean} [options.commit.message.display] - Commit display policy
|
1378 | 1379 | * @param {boolean} [options.commit.message.displayAuthor] - Commit message author policy
|
|
1446 | 1447 | this.commit.dot.size = options.commit.dot.size || 3;
|
1447 | 1448 | this.commit.dot.strokeWidth = options.commit.dot.strokeWidth || null;
|
1448 | 1449 | this.commit.dot.strokeColor = options.commit.dot.strokeColor || null;
|
| 1450 | + this.commit.dot.lineDash = options.commit.dot.lineDash || this.branch.lineDash; |
1449 | 1451 |
|
1450 | 1452 | this.commit.tag = {};
|
1451 | 1453 | this.commit.tag.color = options.commit.tag.color || this.commit.dot.color;
|
|
0 commit comments