Code/Demos/Compass/Components/Mark.cs
using Goo;
using Sandbox.UI;

namespace Sandbox.Compass;

// Pure builder for one strip mark: a centered letter when cardinal, else a thin minor tick.
public static class MarkView
{
    public static Container Build(CompassMath.Mark mark, float leftPx, float bandHeight, float opacity)
    {
        if (mark.IsCardinal)
        {
            return new Container
            {
                Key            = $"m{(int)mark.AngleDeg}",
                Position       = PositionMode.Absolute,
                Left           = leftPx - 12f,
                Top            = 0f,
                Width          = 24f,
                Height         = bandHeight,
                JustifyContent = Justify.Center,
                AlignItems     = Align.Center,
                Opacity        = opacity,
                FontSize       = 16f,
                FontColor      = Color.White,
                Children       = { new Text(CompassMath.CardinalLabel(mark.AngleDeg)) },
            };
        }

        // Minor tick: a thin vertical rect centered at leftPx, in the lower band.
        return new Container
        {
            Key             = $"m{(int)mark.AngleDeg}",
            Position        = PositionMode.Absolute,
            Left            = leftPx - 1f,
            Top             = bandHeight * 0.5f,
            Width           = 2f,
            Height          = bandHeight * 0.4f,
            BackgroundColor = Color.White.WithAlpha(0.6f),
            Opacity         = opacity,
        };
    }
}