From 268dd9849d358aa33132a38d5da1a683bfcb96c4 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 29 Sep 2024 19:09:55 +0800 Subject: [PATCH] enhance: better margin of commit subject (#528) --- src/Models/CommitGraph.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Models/CommitGraph.cs b/src/Models/CommitGraph.cs index 2f8c9a9e..98f7e2b8 100644 --- a/src/Models/CommitGraph.cs +++ b/src/Models/CommitGraph.cs @@ -199,13 +199,13 @@ namespace SourceGit.Models { var major = null as PathHelper; var isMerged = commit.IsMerged; - var oldCount = unsolved.Count; // Update current y offset offsetY += UNIT_HEIGHT; // Find first curves that links to this commit and marks others that links to this commit ended. - double offsetX = H_MARGIN - HALF_WIDTH; + var offsetX = 4 - HALF_WIDTH; + var maxOffsetOld = unsolved.Count > 0 ? unsolved[^1].LastX : offsetX + UNIT_WIDTH; foreach (var l in unsolved) { if (l.Next == commit.SHA) @@ -311,7 +311,7 @@ namespace SourceGit.Models // Margins & merge state (used by Views.Histories). commit.IsMerged = isMerged; - commit.Margin = new Thickness(Math.Max(offsetX + HALF_WIDTH, oldCount * UNIT_WIDTH + H_MARGIN) + H_MARGIN, 0, 0, 0); + commit.Margin = new Thickness(Math.Max(offsetX, maxOffsetOld) + HALF_WIDTH + H_MARGIN, 0, 0, 0); } // Deal with curves haven't ended yet. @@ -323,7 +323,7 @@ namespace SourceGit.Models if (path.Path.Points.Count == 1 && Math.Abs(path.Path.Points[0].Y - endY) < 0.0001) continue; - path.End((i + 0.5) * UNIT_WIDTH + H_MARGIN, endY + HALF_HEIGHT, HALF_HEIGHT); + path.End((i + 0.5) * UNIT_WIDTH + 4, endY + HALF_HEIGHT, HALF_HEIGHT); } unsolved.Clear();