Skip to content

Commit b112ecc

Browse files
authored
Merge pull request #27 from aktnk-tmc/fix-line-drawing-in-commit-graph
Fix line drawing for issue #15
2 parents 66e9638 + 6999c65 commit b112ecc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/components/Commit.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Commit =
1717
<text x="-28" y="15">
1818
<tspan dy="5">{day}</tspan>
1919
</text>
20-
{parents.map(p => {
20+
{parents.map((p, idx, prnts) => {
2121
const h = (p.index - index) * height;
2222
if (lane === p.lane) {
2323
return (
@@ -27,11 +27,19 @@ const Commit =
2727
/>
2828
);
2929
}
30-
if (lane < p.lane) {
30+
if (prnts.length === 2) {
31+
if (lane < p.lane) {
32+
return (
33+
<path
34+
key={p.index} fill="none" strokeWidth="2" stroke={pallet[p.lane % pallet.length]}
35+
d={`M${lane * 15 + 10},15 l5,5 h${(p.lane - lane) * 15 - 10} v${h - 10} l5,5`}
36+
/>
37+
);
38+
}
3139
return (
3240
<path
3341
key={p.index} fill="none" strokeWidth="2" stroke={pallet[p.lane % pallet.length]}
34-
d={`M${lane * 15 + 10},15 l5,5 h${(p.lane - lane) * 15 - 5} v${h - 5}`}
42+
d={`M${lane * 15 + 10},15 l-5,5 h${(p.lane - lane) * 15 + 10} v${h - 10} l-5,5`}
3543
/>
3644
);
3745
}

0 commit comments

Comments
 (0)