主题
Rect
A 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
left | Number | required | The offset of the left edge of this rectangle from the x-axis. |
top | Number | required | The offset of the top edge of this rectangle from the y-axis. |
right | Number | required | The offset of the right edge of this rectangle from the x-axis. |
bottom | Number | required | The offset of the bottom edge of this rectangle from the y-axis. |
只读属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
width | Number | — | The distance between the left and right edges of this rectangle. |
height | Number | — | The distance between the top and bottom edges of this rectangle. |
size | Size | — | The distance between the upper-left corner and the lower-right corner of this rectangle. |
方法
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
copy | 'Rect' | — | 返回此对象的副本,可覆盖指定属性。 |
from_lwth | 'Rect' | — | Construct a rectangle from its left and top edges, its width, and its height. |
from_center | — | — | Constructs a rectangle from its center point, width, and height. The center argument is assumed to be an offset from the origin. |
from_points | — | — | Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin. |