Rect

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

Rect 描述 2D 平面上的长方形。它由两个角、两个 Vector2 位置或四个数字组成:


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

该数据类型在 ImageLabel.SliceCenter 属性中使用,决定缩放图像的中心区域。

概要

构造工具

属性

构造工具

new

构建一个新的 矩形 与两个零位置。

new

构建一个新的 矩形 给出两个 Vector2 位置:min 作为左上角,max 作为右下角。

参数

min: Vector2
max: Vector2

new

使用 **** 和 minX 作为左上角的坐标,以及 minYmaxX 作为右下角的坐标,建造一个新的 maxY

参数

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

属性

Width

长度为像素的 矩形 宽度。

Height

矩形 的高度,以像素计算。

左上角。

右下角。