Defined in: geometry.ts:53
Axis-aligned rectangle.
contains includes boundary points.
Example
ts
const rect = new Rect(10, 20, 30, 40)
rect.contains({ x: 25, y: 40 }) // trueExtends
Shape<"rect">
Constructors
Constructor
new Rect(
x,y,width,height):Rect
Defined in: geometry.ts:56
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Left coordinate. |
y | number | Top coordinate. |
width | number | Rectangle width. |
height | number | Rectangle height. |
Returns
Rect
Overrides
Properties
| Property | Modifier | Type | Default value | Description | Overrides | Defined in |
|---|---|---|---|---|---|---|
height | readonly | number | undefined | Rectangle height. | - | geometry.ts:64 |
type | readonly | "rect" | 'rect' | - | Shape.type | geometry.ts:54 |
width | readonly | number | undefined | Rectangle width. | - | geometry.ts:62 |
x | readonly | number | undefined | Left coordinate. | - | geometry.ts:58 |
y | readonly | number | undefined | Top coordinate. | - | geometry.ts:60 |
Methods
contains()
contains(
point):boolean
Defined in: geometry.ts:75
Checks whether a point is inside or on the rectangle boundary.
Parameters
| Parameter | Type | Description |
|---|---|---|
point | Point | Point to test. |
Returns
boolean
Whether the point is contained by the rectangle.
Overrides
svgPath()
svgPath():
string
Defined in: geometry.ts:87
Generates an SVG path string for the rectangle.
Returns
string
SVG path data.