mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
refactor: rewrite Views.CommitGraph.Render
This commit is contained in:
parent
ddcab64940
commit
45212ebc28
1 changed files with 16 additions and 17 deletions
|
@ -439,6 +439,10 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
base.Render(context);
|
base.Render(context);
|
||||||
|
|
||||||
|
var graph = Graph;
|
||||||
|
if (graph == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var histories = this.FindAncestorOfType<Histories>();
|
var histories = this.FindAncestorOfType<Histories>();
|
||||||
if (histories == null)
|
if (histories == null)
|
||||||
return;
|
return;
|
||||||
|
@ -447,25 +451,20 @@ namespace SourceGit.Views
|
||||||
if (list == null)
|
if (list == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var graph = Graph;
|
// Calculate drawing area.
|
||||||
if (graph == null)
|
double width = Bounds.Width - 156 - 96 - histories.AuthorNameColumnWidth.Value;
|
||||||
return;
|
double height = Bounds.Height;
|
||||||
|
|
||||||
double rowHeight = 28;
|
|
||||||
double startY = list.Scroll?.Offset.Y ?? 0;
|
double startY = list.Scroll?.Offset.Y ?? 0;
|
||||||
double maxWidth = Bounds.Width - 156 - 96 - histories.AuthorNameColumnWidth.Value;
|
double endY = startY + height + 28;
|
||||||
|
|
||||||
// Apply scroll offset.
|
// Apply scroll offset and clip.
|
||||||
context.PushClip(new Rect(Bounds.Left, Bounds.Top, maxWidth, Bounds.Height));
|
using (context.PushClip(new Rect(0, 0, width, height)))
|
||||||
context.PushTransform(Matrix.CreateTranslation(0, -startY));
|
using (context.PushTransform(Matrix.CreateTranslation(0, -startY)))
|
||||||
|
{
|
||||||
// Calculate bounds.
|
// Draw contents
|
||||||
var top = startY;
|
DrawCurves(context, graph, startY, endY);
|
||||||
var bottom = startY + Bounds.Height + rowHeight * 2;
|
DrawAnchors(context, graph, startY, endY);
|
||||||
|
}
|
||||||
// Draw contents
|
|
||||||
DrawCurves(context, graph, top, bottom);
|
|
||||||
DrawAnchors(context, graph, top, bottom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawCurves(DrawingContext context, Models.CommitGraph graph, double top, double bottom)
|
private void DrawCurves(DrawingContext context, Models.CommitGraph graph, double top, double bottom)
|
||||||
|
|
Loading…
Reference in a new issue