Forge
csharpdeeb25a2
1using SkiaSharp;
2
3namespace CascadeIDE.Views.Chat.Skia;
4
5/// <summary>Нумерация сообщений слева от ленты (detail thread).</summary>
6internal static class SkiaChatFeedGutter
7{
8 public static void DrawOrdinal(
9 SkiaChatDrawContext context,
10 float top,
11 float bottom,
12 int ordinal,
13 in SkiaChatFeedLayout layout,
14 bool isSelected)
15 {
16 if (ordinal <= 0)
17 return;
18
19 var gutterRect = new SKRect(context.FeedGutterLeft, top, context.ContentLeft, bottom);
20 using var numFont = SkiaChatFeedFontResolver.CreateFont(layout.GutterFamily, layout.GutterOrdinalFontSize);
21 using var numPaint = new SKPaint
22 {
23 IsAntialias = true,
24 Color = isSelected
25 ? context.Theme.SelectedBorder
26 : SkiaKit.SkiaKitColor.Blend(context.Theme.Role, context.Theme.Content, 0.55f),
27 };
28 var baseline = top + numFont.Size * SkiaChatFeedLayout.TextBaselineFactor + layout.RowEdgePad;
29 context.Canvas.DrawText(
30 ordinal.ToString(),
31 gutterRect.Right - layout.TextInset,
32 baseline,
33 SKTextAlign.Right,
34 numFont,
35 numPaint);
36 }
37}
38
View only · write via MCP/CIDE