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()

    返回一个新的 长方形 用零 Vector2 位置。

  • new(min : Vector2,max : Vector2)

    从给定的 Datatype.Vector2 位置返回一个新的 Rect。

  • new(minX : number,minY : number,maxX : number,maxY : number)

    使用第一个和最后两个参数作为角度的坐标返回一个新的 Rect

属性

构造工具

new

用两个零位置 建造一个新的 Rect

new

使用两个 Vector2 位置给予新的 min:1> min1> 作为左上角,4> max4> 作为右下角。

参数

min: Vector2
max: Vector2

new

使用 minX 和 minX 作为顶端左角的坐标,并使用 minY 和 2>maxY2> 作为底端右角的坐标。

参数

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

属性

Width

在像素中的 长方形 宽度。

Height

在像素上的 长方形 的高度。

左上角。

右下角。