From 8fa19ecd0c9e02443c3df089018d1f04800ba882 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 8 Jul 2024 18:10:26 +0800 Subject: [PATCH] enhance: better commit graph --- src/Models/CommitGraph.cs | 9 +++++++-- src/Views/Histories.axaml.cs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Models/CommitGraph.cs b/src/Models/CommitGraph.cs index 9ed99904..deda6c04 100644 --- a/src/Models/CommitGraph.cs +++ b/src/Models/CommitGraph.cs @@ -61,8 +61,13 @@ namespace SourceGit.Models } else if (x < LastX) { - if (y > LastY + halfHeight) - Add(new Point(LastX, LastY + halfHeight)); + var testY = LastY + halfHeight; + if (y > testY) + Add(new Point(LastX, testY)); + + if (!isEnd) + y += halfHeight; + Add(new Point(x, y)); } else if (isEnd) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 05fe1a81..5d63cfe4 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -193,7 +193,7 @@ namespace SourceGit.Views if (i < size - 1) { var midY = (last.Y + cur.Y) / 2; - ctx.CubicBezierTo(new Point(last.X, midY + 2), new Point(cur.X, midY - 2), cur); + ctx.CubicBezierTo(new Point(last.X, midY + 4), new Point(cur.X, midY - 4), cur); } else {