public sealed struct Sandbox.Rect
Represents a rectangle.
Related Guides
Broader workflow and conceptual references connected to this API.
Constructors
Showing 2 constructors
No results match this filter.
Methods
Showing 22 methods
public Sandbox.Rect Align(Vector2 size, Sandbox.TextFlag align)
Align the smaller rect inside this rect. Default alignment on each axis is Top, Left.
public Sandbox.Rect Ceiling()
Returns a Rect with position and size rounded up.
public Sandbox.Rect Contain(Vector2 size, Sandbox.TextFlag align = 132, bool stretch = False)
Contain a given rectangle (image) within this rectangle (frame), preserving aspect ratio.
Parameters
size: Size of the rectagle (image) to try to contain within this frame rectangle.align: Where to align the given box within this rectangle. Default: 132stretch: Whether to stretch the given rectagle (image) should its size be smaller than largest rectagle (image) size possible within this rectangle (frame). Default: False
Returns
A rectangle with correct position and size to fit within the "parent" rectangle.
public Sandbox.Rect Floor()
Returns a Rect with position and size rounded down.
public static Sandbox.Rect FromPoints(Vector2 a, Vector2 b)
Create a rect between two points. The order of the points doesn't matter.
public Sandbox.Rect Round()
Returns a Rect with position and size rounded to closest integer values.
public Sandbox.Rect SnapToGrid()
Align to a grid
public Vector4 ToVector4()
Returns this rect as a Vector4, where X/Y/Z/W are Left/Top/Right/Bottom respectively.
No results match this filter.
Properties
Showing 14 properties
public float Sandbox.Rect.Bottom { get; set; }
Position of rect's bottom edge relative to its parent.
public Vector2 Sandbox.Rect.BottomRight { get; set; }
Position of the bottom right edge of this rect.
public float Sandbox.Rect.Height { get; set; }
Height of the rect.
public float Sandbox.Rect.Left { get; set; }
Position of rect's left edge relative to its parent, can also be interpreted as its position on the X axis.
public float Sandbox.Rect.Right { get; set; }
Position of rect's right edge relative to its parent.
public float Sandbox.Rect.Top { get; set; }
Position of rect's top edge relative to its parent, can also be interpreted as its position on the Y axis.
public float Sandbox.Rect.Width { get; set; }
Width of the rect.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.System |
| Doc ID | T:Sandbox.Rect |