Skip to content

@putianyi888/vue3-plots


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 }) // true

Extends ​

Constructors ​

Constructor ​

new Rect(x, y, width, height): Rect

Defined in: geometry.ts:56

Parameters ​

ParameterTypeDescription
xnumberLeft coordinate.
ynumberTop coordinate.
widthnumberRectangle width.
heightnumberRectangle height.

Returns ​

Rect

Overrides ​

Shape.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionOverridesDefined in
heightreadonlynumberundefinedRectangle height.-geometry.ts:64
typereadonly"rect"'rect'-Shape.typegeometry.ts:54
widthreadonlynumberundefinedRectangle width.-geometry.ts:62
xreadonlynumberundefinedLeft coordinate.-geometry.ts:58
yreadonlynumberundefinedTop 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 ​

ParameterTypeDescription
pointPointPoint to test.

Returns ​

boolean

Whether the point is contained by the rectangle.

Overrides ​

Shape.contains


svgPath() ​

svgPath(): string

Defined in: geometry.ts:87

Generates an SVG path string for the rectangle.

Returns ​

string

SVG path data.

Overrides ​

Shape.svgPath