mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
ux: different node in graph (#395)
This commit is contained in:
parent
7389f5d521
commit
e6f3ab5e68
3 changed files with 62 additions and 25 deletions
|
@ -475,25 +475,14 @@ namespace SourceGit.Views
|
|||
var top = startY;
|
||||
var bottom = startY + grid.Bounds.Height + rowHeight * 2;
|
||||
|
||||
// Draw all curves
|
||||
DrawCurves(context, top, bottom);
|
||||
|
||||
// Draw connect dots
|
||||
IBrush dotFill = DotBrush;
|
||||
foreach (var dot in graph.Dots)
|
||||
{
|
||||
if (dot.Center.Y < top)
|
||||
continue;
|
||||
if (dot.Center.Y > bottom)
|
||||
break;
|
||||
|
||||
context.DrawEllipse(dotFill, Models.CommitGraph.Pens[dot.Color], dot.Center, 3, 3);
|
||||
}
|
||||
// Draw contents
|
||||
DrawCurves(context, graph, top, bottom);
|
||||
DrawAnchors(context, graph, top, bottom);
|
||||
}
|
||||
|
||||
private void DrawCurves(DrawingContext context, double top, double bottom)
|
||||
private void DrawCurves(DrawingContext context, Models.CommitGraph graph, double top, double bottom)
|
||||
{
|
||||
foreach (var line in Graph.Paths)
|
||||
foreach (var line in graph.Paths)
|
||||
{
|
||||
var last = line.Points[0];
|
||||
var size = line.Points.Count;
|
||||
|
@ -561,7 +550,7 @@ namespace SourceGit.Views
|
|||
context.DrawGeometry(null, pen, geo);
|
||||
}
|
||||
|
||||
foreach (var link in Graph.Links)
|
||||
foreach (var link in graph.Links)
|
||||
{
|
||||
if (link.End.Y < top)
|
||||
continue;
|
||||
|
@ -578,6 +567,39 @@ namespace SourceGit.Views
|
|||
context.DrawGeometry(null, Models.CommitGraph.Pens[link.Color], geo);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawAnchors(DrawingContext context, Models.CommitGraph graph, double top, double bottom)
|
||||
{
|
||||
IBrush dotFill = DotBrush;
|
||||
Pen dotFillPen = new Pen(dotFill, 2);
|
||||
|
||||
foreach (var dot in graph.Dots)
|
||||
{
|
||||
if (dot.Center.Y < top)
|
||||
continue;
|
||||
if (dot.Center.Y > bottom)
|
||||
break;
|
||||
|
||||
var pen = Models.CommitGraph.Pens[dot.Color];
|
||||
switch (dot.Type)
|
||||
{
|
||||
case Models.CommitGraph.DotType.Head:
|
||||
context.DrawEllipse(dotFill, pen, dot.Center, 6, 6);
|
||||
context.DrawEllipse(pen.Brush, null, dot.Center, 2, 2);
|
||||
break;
|
||||
case Models.CommitGraph.DotType.Merge:
|
||||
context.DrawEllipse(pen.Brush, null, dot.Center, 6, 6);
|
||||
context.DrawLine(dotFillPen, new Point(dot.Center.X, dot.Center.Y - 3), new Point(dot.Center.X, dot.Center.Y + 3));
|
||||
context.DrawLine(dotFillPen, new Point(dot.Center.X - 3, dot.Center.Y), new Point(dot.Center.X + 3, dot.Center.Y));
|
||||
break;
|
||||
default:
|
||||
context.DrawEllipse(dotFill, pen, dot.Center, 3, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Geometry _mergeIcon = null;
|
||||
}
|
||||
|
||||
public partial class Histories : UserControl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue