RectExtensions

Defines a collection of handy Rect transformation methods, that can chained together for complex behaviour. Note that no method defined here changes the original Rect, but instead returns a new transformed Rect.

namespace Sirenix.Utilities
{
[ExtensionAttribute]
public static class RectExtensions
}

Requirements

Namespace: Sirenix.Utilities
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

Extension Methods

Return Type Definition Description
Rect AddMax(this Rect, Vector2) Adds to a Rect's max position.
Rect AddMin(this Rect, Vector2) Adds to a Rect's min position.
Rect AddPosition(this Rect, float, float) Moves a Rect's position by the specified amount.
Rect AddPosition(this Rect, Vector2) Moves a Rect's position by the specified amount.
Rect AddX(this Rect, float) Adds to a Rect's X position.
Rect AddXMax(this Rect, float) Adds to a Rect's X max position.
Rect AddXMin(this Rect, float) Adds to a Rect's X min position.
Rect AddY(this Rect, float) Adds to a Rect's Y position.
Rect AddYMax(this Rect, float) Adds to a Rect's Y max position.
Rect AddYMin(this Rect, float) Adds to a Rect's Y min position.
Rect AlignBottom(this Rect, float) Returns a Rect, with the specified height, that has been aligned to the bottom of the original Rect.
Rect AlignCenter(this Rect, float) Returns a Rect, with the specified width, that has been aligned to horizontal center of the original Rect.
Rect AlignCenter(this Rect, float, float) Returns a Rect, with the specified width and height in the center of the provided rect.
Rect AlignCenterX(this Rect, float) Returns a Rect, with the specified width, that has been aligned horizontally to the center of the original rect.
Rect AlignCenterXY(this Rect, float) Returns a Rect, with the specified width and height, that has been aligned vertically to the center of the original rect.
Rect AlignCenterY(this Rect, float) Returns a Rect, with the specified height, that has been aligned vertically to the center of the original rect.
Rect AlignLeft(this Rect, float) Returns a Rect, with the specified width, that has been aligned to the left of the original Rect.
Rect AlignMiddle(this Rect, float) Returns a Rect, with the specified height, that has been aligned to the vertical middle of the original Rect.
Rect AlignRight(this Rect, float) Returns a Rect, with the specified width, that has been aligned to the right of the original Rect.
Rect AlignRight(this Rect, float, bool) Returns a Rect, with the specified width, that has been aligned to the right of the original Rect.
Rect AlignTop(this Rect, float) Returns a Rect, with the specified height, that has been aligned to the top of the original Rect.
Rect Expand(this Rect, float) Returns a Rect that has been expanded by the specified amount.
Rect Expand(this Rect, float, float) Returns a Rect that has been expanded by the specified amount.
Rect Expand(this Rect, float, float, float, float) Returns a Rect that has been expanded by the specified amount.
Rect ExpandTo(this Rect, Vector2) Expands a rect to contain a given position.
Rect HorizontalPadding(this Rect, float) Returns a Rect that has been inserted by the specified amount on the X-axis.
Rect HorizontalPadding(this Rect, float, float) Returns a Rect that has been inserted by the specified amount on the X-axis.
Rect MaxHeight(this Rect, float) Sets a Rect's height, if it is greater than the specified value.
Rect MaxWidth(this Rect, float) Sets a Rect's width, if it is greater than the specified value.
Rect MinHeight(this Rect, float) Sets a Rect's height, if it is less than the specified value.
Rect MinWidth(this Rect, float) Sets a Rect's width, if it is less than the specified value.
Rect Padding(this Rect, float) Returns a Rect that has been inserted by the specified amount.
Rect Padding(this Rect, float, float) Returns a Rect that has been inserted by the specified amount.
Rect Padding(this Rect, float, float, float, float) Returns a Rect that has been inserted by the specified amount.
Rect ResetPosition(this Rect) Resets a Rect's position to zero.
Rect SetCenter(this Rect, float, float) Moves a Rect to the specified center position.
Rect SetCenter(this Rect, Vector2) Moves a Rect to the specified center position.
Rect SetCenterX(this Rect, float) Moves a Rect to the specified center X position.
Rect SetCenterY(this Rect, float) Moves a Rect to the specified center Y position.
Rect SetHeight(this Rect, float) Returns a Rect with the specified height.
Rect SetMax(this Rect, Vector2) Sets a Rect's max position.
Rect SetMin(this Rect, Vector2) Sets the min position of a Rect.
Rect SetPosition(this Rect, Vector2) Moves a Rect to the specified position.
Rect SetSize(this Rect, float, float) Returns a Rect with the specified size.
Rect SetSize(this Rect, Vector2) Returns a Rect with the specified size.
Rect SetWidth(this Rect, float) Returns a Rect with the specified width.
Rect SetX(this Rect, float) Sets a Rect's X position.
Rect SetXMax(this Rect, float) Sets a Rect's X max position.
Rect SetXMin(this Rect, float) Sets a Rect's X min position.
Rect SetY(this Rect, float) Sets a Rect's Y position.
Rect SetYMax(this Rect, float) Sets a Rect's Y max position.
Rect SetYMin(this Rect, float) Sets a Rect's Y min position.
Rect Split(this Rect, int, int) Splits a Rect horizontally into the specified number of sub-rects, and returns a sub-rect for the specified index.
Rect SplitGrid(this Rect, float, float, int) Splits a Rect into a grid from left to right and then down.
Rect SplitTableGrid(this Rect, int, float, int) Splits a Rect into a grid from left to right and then down.
Rect SplitVertical(this Rect, int, int) Splits a Rect vertically into the specified number of sub-rects, and returns a sub-rect for the specified index.
Rect SubMax(this Rect, Vector2) Subtracts a Rect's max position.
Rect SubMin(this Rect, Vector2) Subtracts a Rect's min position.
Rect SubX(this Rect, float) Subtracts from a Rect's X position.
Rect SubXMax(this Rect, float) Subtracts a Rect's X max position.
Rect SubXMin(this Rect, float) Subtracts from a Rect's X min position.
Rect SubY(this Rect, float) Subtracts a Rect's Y position.
Rect SubYMax(this Rect, float) Subtracts from a Rect's Y max position.
Rect SubYMin(this Rect, float) Subtracts a Rect's Y min position.
Rect VerticalPadding(this Rect, float) Returns a Rect that has been inserted by the specified amount on the Y-axis.
Rect VerticalPadding(this Rect, float, float) Returns a Rect that has been inserted by the specified amount on the Y-axis.