Rectclass
Represents a rectangle.
Constructors2
Showing 2 constructors
No results match this filter.
Methods22
Showing 22 methods
public Sandbox.Rect AddPoint(Vector2 pos)
Returns this rect expanded to include this point
| Parameter | Type | Description |
|---|---|---|
| pos | Vector2 | — |
public Sandbox.Rect Align(Vector2 size, Sandbox.TextFlag align)
Align the smaller rect inside this rect. Default alignment on each axis is Top, Left.
| Parameter | Type | Description |
|---|---|---|
| size | Vector2 | — |
| align | TextFlag | — |
public Vector2 ClosestPoint(Vector2 point)
Returns the closest point on this rect to another point
| Parameter | Type | Description |
|---|---|---|
| point | Vector2 | — |
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.
| Parameter | Type | Description |
|---|---|---|
| size | Vector2 | Size of the rectagle (image) to try to contain within this frame rectangle. |
| align = 132 | TextFlag | Where to align the given box within this rectangle. |
| stretch = False | bool | Whether to stretch the given rectagle (image) should its size be smaller than largest rectagle (image) size possible within this rectangle (frame). |
public static Sandbox.Rect FromPoints(Vector2 a, Vector2 b)
Create a rect between two points. The order of the points doesn't matter.
| Parameter | Type | Description |
|---|---|---|
| a | Vector2 | — |
| b | Vector2 | — |
public Sandbox.Rect Round()
Returns a Rect with position and size rounded to closest integer values.
No results match this filter.
Properties14
Showing 14 properties
public float Sandbox.Rect.Bottom { get; set; }
Position of rect's bottom edge relative to its parent.
float—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.
float—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.
float—public float Sandbox.Rect.Right { get; set; }
Position of rect's right edge relative to its parent.
float—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.
float—public float Sandbox.Rect.Width { get; set; }
Width of the rect.
float—No results match this filter.