Editor/HighPrecisionControlWidget.cs
using Editor;
using ExtendedBox.Editors.Attributes;
using ExtendedBox.General;
using Sandbox;

namespace ExtendedBox;

[CustomEditor(typeof(float), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
[CustomEditor(typeof(decimal), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
[CustomEditor(typeof(double), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
public class HighPrecisionFloatControlWidget : FloatControlWidget
{
    public HighPrecisionFloatControlWidget(SerializedProperty property) : base(property)
    {
    }

    protected override string ValueToString()
    {
        double num = SerializedProperty.As.Double;
        if(num == 0.0)
            num = 0.0;

        string format = "0.#######";
        if(SerializedProperty.TryGetAttribute<HighPrecisionAttribute>(out var attribute))
            format = attribute.Format;

        return num.ToString(format);
    }
}

[CustomEditor(typeof(Vector2), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
[CustomEditor(typeof(Vector3), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
[CustomEditor(typeof(Vector4), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
public class HighPrecisionVectorControlWidget : ControlObjectWidget
{
    private FloatControlWidget? _firstControl;

    public override bool SupportsMultiEdit => true;

    public HighPrecisionVectorControlWidget(SerializedProperty property)
        : base(property, true)
    {
        Layout = Layout.Row();
        Layout.Spacing = 2f;

        _firstControl = TryAddField("x", Theme.Red, "X");
        TryAddField("y", Theme.Green, "Y");
        TryAddField("z", Theme.Blue, "Z");
        TryAddField("w", Theme.Yellow, "W");
    }

    private FloatControlWidget? TryAddField(string propertyName, Color color, string text)
    {
        SerializedProperty property = SerializedObject.GetProperty(propertyName);
        if(property == null)
            return null;

        FloatControlWidget floatControlWidget = Layout.Add(new HighPrecisionFloatControlWidget(property)
        {
            HighlightColor = color,
            Label = text
        });

        floatControlWidget.MinimumWidth = Theme.RowHeight;
        floatControlWidget.HorizontalSizeMode = SizeMode.Expand | SizeMode.CanGrow;
        return floatControlWidget;
    }

    public override void StartEditing()
    {
        _firstControl?.StartEditing();
    }

    protected override void OnPaint()
    {
    }
}

[CustomEditor(typeof(BBox), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
[CustomEditor(typeof(BBox2), WithAllAttributes = [typeof(HighPrecisionAttribute)])]
public class HighPrecisionBBoxControlWidget : ControlObjectWidget
{
    public override bool SupportsMultiEdit => true;

    public HighPrecisionBBoxControlWidget(SerializedProperty property)
        : base(property, true)
    {
        PaintBackground = false;
        Layout = Layout.Column();
        Layout.Spacing = 2f;

        Layout.Add(new HighPrecisionVectorControlWidget(SerializedObject.GetProperty("Mins")));
        Layout.Add(new HighPrecisionVectorControlWidget(SerializedObject.GetProperty("Maxs")));
    }
}