diff --git a/Dashboard.Common/Box2d.cs b/Dashboard.Common/Box2d.cs index 974228e..0904525 100644 --- a/Dashboard.Common/Box2d.cs +++ b/Dashboard.Common/Box2d.cs @@ -1,14 +1,15 @@ -using System.ComponentModel.DataAnnotations; +using System.Diagnostics; using System.Drawing; using System.Numerics; namespace Dashboard { + [DebuggerDisplay("\\{{Min}; {Max}\\}")] public readonly record struct Box2d(Vector2 Min, Vector2 Max) { public float Left => Min.X; - public float Right => Max.X; public float Top => Min.Y; + public float Right => Max.X; public float Bottom => Max.Y; public Vector2 Size => Max - Min; diff --git a/Dashboard.Common/Box3d.cs b/Dashboard.Common/Box3d.cs index e920fc8..a37ecc4 100644 --- a/Dashboard.Common/Box3d.cs +++ b/Dashboard.Common/Box3d.cs @@ -1,8 +1,9 @@ -using System.Drawing; +using System.Diagnostics; using System.Numerics; namespace Dashboard { + [DebuggerDisplay("\\{{Min}; {Max}\\}")] public readonly record struct Box3d(Vector3 Min, Vector3 Max) { public float Left => Min.X; diff --git a/Dashboard.Common/Extents.cs b/Dashboard.Common/Extents.cs new file mode 100644 index 0000000..8e7e15c --- /dev/null +++ b/Dashboard.Common/Extents.cs @@ -0,0 +1,29 @@ +using System.Diagnostics; +using System.Numerics; + +namespace Dashboard +{ + [DebuggerDisplay("{Value}")] + public readonly record struct Extents(Vector4 Value) + { + public float Left => Value.X; + public float Top => Value.Y; + public float Right => Value.Z; + public float Bottom => Value.W; + + public float ExtentWidth => Left + Right; + + public float ExtentHeight => Top + Bottom; + + public Vector2 ExtentSize => new(ExtentWidth, ExtentHeight); + + public Extents(float left, float top, float right, float bottom) + : this(new Vector4(left, top, right, bottom)) + { + } + + public Extents(float value) : this(new Vector4(value)) + { + } + } +} \ No newline at end of file