Skip to content

RectInt(JavaScript) ​

RectInt ​

Scripting Name:Insight.RectInt

二维矩形。

Properties ​


center ​

type :Insight.Vector2

(只读)中心点。

height ​

type :number

高度。

max ​

type :Insight.Vector2

右上角。

min ​

type :Insight.Vector2

左下角。

position ​

type :Insight.Vector2

位置。

size ​

type :Insight.Vector2

大小。

width ​

type :number

宽度。

x ​

type :number

x 位置。

xMax ​

type :number

右上角 x 位置。

xMin ​

type :number

左下角 x 位置。

y ​

type :number

y 位置。

yMax ​

type :number

右上角 y 位置。

yMin ​

type :number

左下角 y 位置。

Methods ​


toString ​

javascript
toString(): string

将 rect 内容以一定格式转为 string 类型。

clampToBounds ​

javascript
clampToBounds(bounds: Insight.RectInt): void;

求两个矩形的交集然后赋给本矩形。

Parameters

  • bounds : Insight.RectInt 另一个矩形

contains ​

javascript
contains(position: Insight.Vector2): boolean;

判断一个点是否在矩形中。落在矩形边界上的点也会返回 true。

Parameters

setMinMax ​

javascript
setMinMax(minPosition: Insight.Vector2, maxPosition: Insight.Vector2): void;

设置矩形的左下角和右上角。

Parameters