mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
ux: new style for inline code in commit subject
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
0a7b973388
commit
6df38ad970
2 changed files with 25 additions and 16 deletions
|
@ -25,7 +25,7 @@
|
||||||
<Color x:Key="Color.Diff.AddedHighlight">#A7E1A7</Color>
|
<Color x:Key="Color.Diff.AddedHighlight">#A7E1A7</Color>
|
||||||
<Color x:Key="Color.Diff.DeletedHighlight">#F19B9D</Color>
|
<Color x:Key="Color.Diff.DeletedHighlight">#F19B9D</Color>
|
||||||
<Color x:Key="Color.Link">#0000EE</Color>
|
<Color x:Key="Color.Link">#0000EE</Color>
|
||||||
<Color x:Key="Color.InlineCode">#FFE5E5E5</Color>
|
<Color x:Key="Color.InlineCode">#FFE4E4E4</Color>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
<ResourceDictionary x:Key="Dark">
|
<ResourceDictionary x:Key="Dark">
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<Color x:Key="Color.Diff.AddedHighlight">#A0308D3C</Color>
|
<Color x:Key="Color.Diff.AddedHighlight">#A0308D3C</Color>
|
||||||
<Color x:Key="Color.Diff.DeletedHighlight">#A09F4247</Color>
|
<Color x:Key="Color.Diff.DeletedHighlight">#A09F4247</Color>
|
||||||
<Color x:Key="Color.Link">#4DAAFC</Color>
|
<Color x:Key="Color.Link">#4DAAFC</Color>
|
||||||
<Color x:Key="Color.InlineCode">#FF2E2E2E</Color>
|
<Color x:Key="Color.InlineCode">#FF383838</Color>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ResourceDictionary.ThemeDictionaries>
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
|
||||||
|
|
|
@ -104,23 +104,32 @@ namespace SourceGit.Views
|
||||||
if (_inlines.Count == 0)
|
if (_inlines.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var height = Bounds.Height;
|
var ro = new RenderOptions()
|
||||||
var width = Bounds.Width;
|
|
||||||
foreach (var inline in _inlines)
|
|
||||||
{
|
{
|
||||||
if (inline.X > width)
|
TextRenderingMode = TextRenderingMode.SubpixelAntialias,
|
||||||
return;
|
EdgeMode = EdgeMode.Antialias
|
||||||
|
};
|
||||||
|
|
||||||
if (inline.Element is { Type: Models.InlineElementType.Code })
|
using (context.PushRenderOptions(ro))
|
||||||
|
{
|
||||||
|
var height = Bounds.Height;
|
||||||
|
var width = Bounds.Width;
|
||||||
|
foreach (var inline in _inlines)
|
||||||
{
|
{
|
||||||
var rect = new Rect(inline.X, (height - inline.Text.Height - 2) * 0.5, inline.Text.WidthIncludingTrailingWhitespace + 8, inline.Text.Height + 2);
|
if (inline.X > width)
|
||||||
var roundedRect = new RoundedRect(rect, new CornerRadius(4));
|
return;
|
||||||
context.DrawRectangle(InlineCodeBackground, null, roundedRect);
|
|
||||||
context.DrawText(inline.Text, new Point(inline.X + 4, (height - inline.Text.Height) * 0.5));
|
if (inline.Element is { Type: Models.InlineElementType.Code })
|
||||||
}
|
{
|
||||||
else
|
var rect = new Rect(inline.X, (height - inline.Text.Height - 2) * 0.5, inline.Text.WidthIncludingTrailingWhitespace + 8, inline.Text.Height + 2);
|
||||||
{
|
var roundedRect = new RoundedRect(rect, new CornerRadius(4));
|
||||||
context.DrawText(inline.Text, new Point(inline.X, (height - inline.Text.Height) * 0.5));
|
context.DrawRectangle(InlineCodeBackground, null, roundedRect);
|
||||||
|
context.DrawText(inline.Text, new Point(inline.X + 4, (height - inline.Text.Height) * 0.5));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
context.DrawText(inline.Text, new Point(inline.X, (height - inline.Text.Height) * 0.5));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue