Rect

Show Deprecated

Rect describes a rectangle on a 2D plane. It is constructed using two corners, either two Vector2 positions or four numbers:


local rect1 = Rect.new(Vector2.new(10, 10), Vector2.new(80, 80))
local rect2 = Rect.new(10, 10, 80, 80)

This data type is used in the ImageLabel.SliceCenter property which determines the center area of a scaled image.

Summary

Constructors

Properties

Constructors

new

Constructs a new Rect with two zero Vector2 positions.

new

Constructs a new Rect given two Vector2 positions: min as the top-left corner and max as the bottom-right corner.

Parameters

min: Vector2
max: Vector2

new

Constructs a new Rect using minX and minY as coordinates for the top-left corner, and maxX and maxY as coordinates for the bottom-right corner.

Parameters

minX: number
minY: number
maxX: number
maxY: number

Properties

Width

The width of the Rect in pixels.

Height

The height of the Rect in pixels.

The top-left corner.

The bottom-right corner.