mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
ux: add Background
property to avoid unclear display for selected state
This commit is contained in:
parent
9dcb46603d
commit
1ec7123584
2 changed files with 17 additions and 0 deletions
|
@ -37,6 +37,15 @@ namespace SourceGit.Views
|
||||||
set => SetValue(FontSizeProperty, value);
|
set => SetValue(FontSizeProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<IBrush> BackgroundProperty =
|
||||||
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(Background), null);
|
||||||
|
|
||||||
|
public IBrush Background
|
||||||
|
{
|
||||||
|
get => GetValue(BackgroundProperty);
|
||||||
|
set => SetValue(BackgroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<IBrush> ForegroundProperty =
|
public static readonly StyledProperty<IBrush> ForegroundProperty =
|
||||||
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(Foreground), Brushes.White);
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(Foreground), Brushes.White);
|
||||||
|
|
||||||
|
@ -71,6 +80,9 @@ namespace SourceGit.Views
|
||||||
FontSizeProperty,
|
FontSizeProperty,
|
||||||
ForegroundProperty,
|
ForegroundProperty,
|
||||||
TagBackgroundProperty);
|
TagBackgroundProperty);
|
||||||
|
|
||||||
|
AffectsRender<CommitRefsPresenter>(
|
||||||
|
BackgroundProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(DrawingContext context)
|
public override void Render(DrawingContext context)
|
||||||
|
@ -80,6 +92,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
var useGraphColor = UseGraphColor;
|
var useGraphColor = UseGraphColor;
|
||||||
var fg = Foreground;
|
var fg = Foreground;
|
||||||
|
var bg = Background;
|
||||||
var x = 1.0;
|
var x = 1.0;
|
||||||
foreach (var item in _items)
|
foreach (var item in _items)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +111,9 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (bg != null)
|
||||||
|
context.DrawRectangle(bg, null, entireRect);
|
||||||
|
|
||||||
var labelRect = new RoundedRect(new Rect(x + 16, 0, item.Label.Width + 8, 16), new CornerRadius(0, 2, 2, 0));
|
var labelRect = new RoundedRect(new Rect(x + 16, 0, item.Label.Width + 8, 16), new CornerRadius(0, 2, 2, 0));
|
||||||
using (context.PushOpacity(.2))
|
using (context.PushOpacity(.2))
|
||||||
context.DrawRectangle(item.Brush, null, labelRect);
|
context.DrawRectangle(item.Brush, null, labelRect);
|
||||||
|
|
|
@ -138,6 +138,7 @@
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
<v:CommitRefsPresenter Grid.Column="1"
|
<v:CommitRefsPresenter Grid.Column="1"
|
||||||
|
Background="{DynamicResource Brush.Contents}"
|
||||||
TagBackground="{DynamicResource Brush.DecoratorTag}"
|
TagBackground="{DynamicResource Brush.DecoratorTag}"
|
||||||
Foreground="{DynamicResource Brush.FG1}"
|
Foreground="{DynamicResource Brush.FG1}"
|
||||||
FontFamily="{DynamicResource Fonts.Primary}"
|
FontFamily="{DynamicResource Fonts.Primary}"
|
||||||
|
|
Loading…
Reference in a new issue