Defined in: geometry.ts:28
Abstract base class implemented by all built-in geometry shapes.
Use the type discriminator to narrow emitted shapes.
Example
ts
function handleShape(shape: AnyShape) {
if (shape.type === 'rect') {
console.log(shape.width)
}
}Extended by
Type Parameters
| Type Parameter |
|---|
TType extends ShapeType |
Constructors
Constructor
new Shape<
TType>():Shape<TType>
Returns
Shape<TType>
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
type | abstract | TType | geometry.ts:29 |
Methods
contains()
abstractcontains(point):boolean
Defined in: geometry.ts:34
Checks whether a point is inside the shape.
Parameters
| Parameter | Type |
|---|---|
point | Point |
Returns
boolean
svgPath()
abstractsvgPath():string
Defined in: geometry.ts:39
Generates an SVG path string for the shape boundary.
Returns
string