ux: tree folder icon margin

This commit is contained in:
leo 2024-07-14 16:06:40 +08:00
parent a807aa9e12
commit 24ca3eaf8c
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View file

@ -67,7 +67,7 @@
<!-- Content Area (allows double-click) --> <!-- Content Area (allows double-click) -->
<Grid Grid.Column="1" <Grid Grid.Column="1"
Background="Transparent" Background="Transparent"
ColumnDefinitions="20,*,Auto,Auto" ColumnDefinitions="18,*,Auto,Auto"
DoubleTapped="OnDoubleTappedBranchNode"> DoubleTapped="OnDoubleTappedBranchNode">
<!-- Icon --> <!-- Icon -->

View file

@ -68,18 +68,18 @@ namespace SourceGit.Views
switch (obj.Type) switch (obj.Type)
{ {
case Models.ObjectType.Blob: case Models.ObjectType.Blob:
CreateContent("Icons.File"); CreateContent("Icons.File", new Thickness(0, 0, 0, 0));
break; break;
case Models.ObjectType.Commit: case Models.ObjectType.Commit:
CreateContent("Icons.Submodule"); CreateContent("Icons.Submodule", new Thickness(0, 0, 0, 0));
break; break;
default: default:
CreateContent(node.IsExpanded ? "Icons.Folder.Open" : "Icons.Folder.Fill", Brushes.Goldenrod); CreateContent(node.IsExpanded ? "Icons.Folder.Open" : "Icons.Folder.Fill", new Thickness(0, 2, 0, 0), Brushes.Goldenrod);
break; break;
} }
} }
private void CreateContent(string iconKey, IBrush fill = null) private void CreateContent(string iconKey, Thickness margin, IBrush fill = null)
{ {
var geo = this.FindResource(iconKey) as StreamGeometry; var geo = this.FindResource(iconKey) as StreamGeometry;
if (geo == null) if (geo == null)
@ -89,6 +89,7 @@ namespace SourceGit.Views
{ {
Width = 14, Width = 14,
Height = 14, Height = 14,
Margin = margin,
HorizontalAlignment = HorizontalAlignment.Left, HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Data = geo, Data = geo,