mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-30 16:44:59 +00:00
enhance: improve QueryCommits performance
This commit is contained in:
parent
1a18235a76
commit
064d04fccc
7 changed files with 72 additions and 64 deletions
|
@ -23,7 +23,7 @@
|
|||
IsReadOnly="True"
|
||||
HeadersVisibility="None"
|
||||
Focusable="False"
|
||||
RowHeight="{Binding DataGridRowHeight}"
|
||||
RowHeight="28"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
LayoutUpdated="OnCommitDataGridLayoutUpdated"
|
||||
|
|
|
@ -69,17 +69,6 @@ namespace SourceGit.Views
|
|||
|
||||
public class CommitGraph : Control
|
||||
{
|
||||
public static readonly Pen[] Pens = [
|
||||
new Pen(Brushes.Orange, 2),
|
||||
new Pen(Brushes.ForestGreen, 2),
|
||||
new Pen(Brushes.Gold, 2),
|
||||
new Pen(Brushes.Magenta, 2),
|
||||
new Pen(Brushes.Red, 2),
|
||||
new Pen(Brushes.Gray, 2),
|
||||
new Pen(Brushes.Turquoise, 2),
|
||||
new Pen(Brushes.Olive, 2),
|
||||
];
|
||||
|
||||
public static readonly StyledProperty<Models.CommitGraph> GraphProperty =
|
||||
AvaloniaProperty.Register<CommitGraph, Models.CommitGraph>(nameof(Graph));
|
||||
|
||||
|
@ -151,7 +140,7 @@ namespace SourceGit.Views
|
|||
if (dot.Center.Y > bottom)
|
||||
break;
|
||||
|
||||
context.DrawEllipse(dotFill, Pens[dot.Color], dot.Center, 3, 3);
|
||||
context.DrawEllipse(dotFill, Models.CommitGraph.Pens[dot.Color], dot.Center, 3, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +157,7 @@ namespace SourceGit.Views
|
|||
continue;
|
||||
|
||||
var geo = new StreamGeometry();
|
||||
var pen = Pens[line.Color];
|
||||
var pen = Models.CommitGraph.Pens[line.Color];
|
||||
using (var ctx = geo.Open())
|
||||
{
|
||||
var started = false;
|
||||
|
@ -238,7 +227,7 @@ namespace SourceGit.Views
|
|||
ctx.QuadraticBezierTo(link.Control, link.End);
|
||||
}
|
||||
|
||||
context.DrawGeometry(null, Pens[link.Color], geo);
|
||||
context.DrawGeometry(null, Models.CommitGraph.Pens[link.Color], geo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1166,25 +1166,31 @@ namespace SourceGit.Views
|
|||
{
|
||||
base.OnPropertyChanged(change);
|
||||
|
||||
var data = TextDiff;
|
||||
if (data == null)
|
||||
{
|
||||
Content = null;
|
||||
SyncScrollOffset = Vector.Zero;
|
||||
return;
|
||||
}
|
||||
|
||||
if (change.Property == TextDiffProperty)
|
||||
{
|
||||
if (TextDiff == null)
|
||||
Content = null;
|
||||
else if (UseSideBySideDiff)
|
||||
if (UseSideBySideDiff)
|
||||
Content = new ViewModels.TwoSideTextDiff(TextDiff);
|
||||
else
|
||||
Content = TextDiff;
|
||||
|
||||
SetCurrentValue(SyncScrollOffsetProperty, TextDiff.SyncScrollOffset);
|
||||
}
|
||||
else if (change.Property == UseSideBySideDiffProperty)
|
||||
{
|
||||
SyncScrollOffset = Vector.Zero;
|
||||
|
||||
if (TextDiff == null)
|
||||
Content = null;
|
||||
else if (UseSideBySideDiff)
|
||||
if (UseSideBySideDiff)
|
||||
Content = new ViewModels.TwoSideTextDiff(TextDiff);
|
||||
else
|
||||
Content = TextDiff;
|
||||
|
||||
SetCurrentValue(SyncScrollOffsetProperty, Vector.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue