Skip to content

Commit 268dd98

Browse files
committed
enhance: better margin of commit subject (#528)
1 parent fbfca7b commit 268dd98

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Models/CommitGraph.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
199199
{
200200
var major = null as PathHelper;
201201
var isMerged = commit.IsMerged;
202-
var oldCount = unsolved.Count;
203202

204203
// Update current y offset
205204
offsetY += UNIT_HEIGHT;
206205

207206
// Find first curves that links to this commit and marks others that links to this commit ended.
208-
double offsetX = H_MARGIN - HALF_WIDTH;
207+
var offsetX = 4 - HALF_WIDTH;
208+
var maxOffsetOld = unsolved.Count > 0 ? unsolved[^1].LastX : offsetX + UNIT_WIDTH;
209209
foreach (var l in unsolved)
210210
{
211211
if (l.Next == commit.SHA)
@@ -311,7 +311,7 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
311311

312312
// Margins & merge state (used by Views.Histories).
313313
commit.IsMerged = isMerged;
314-
commit.Margin = new Thickness(Math.Max(offsetX + HALF_WIDTH, oldCount * UNIT_WIDTH + H_MARGIN) + H_MARGIN, 0, 0, 0);
314+
commit.Margin = new Thickness(Math.Max(offsetX, maxOffsetOld) + HALF_WIDTH + H_MARGIN, 0, 0, 0);
315315
}
316316

317317
// Deal with curves haven't ended yet.
@@ -323,7 +323,7 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
323323
if (path.Path.Points.Count == 1 && Math.Abs(path.Path.Points[0].Y - endY) < 0.0001)
324324
continue;
325325

326-
path.End((i + 0.5) * UNIT_WIDTH + H_MARGIN, endY + HALF_HEIGHT, HALF_HEIGHT);
326+
path.End((i + 0.5) * UNIT_WIDTH + 4, endY + HALF_HEIGHT, HALF_HEIGHT);
327327
}
328328
unsolved.Clear();
329329

0 commit comments

Comments
 (0)