New to Kendo UI for AngularStart a free 30-day trial

Rect

Class

Represents a rectangle with position and dimensions. Provides methods for geometric operations and transformations.

Definition

Package:@progress/kendo-angular-diagrams

Methods

Gets the bottom center point of the rectangle.

Returns:

Point

A Point at the bottom center edge

Gets the bottom-left corner point of the rectangle.

Returns:

Point

A Point at the bottom-left corner

Gets the bottom-right corner point of the rectangle.

Returns:

Point

A Point at the bottom-right corner

Gets the center point of the rectangle.

Returns:

Point

A Point representing the center of the rectangle

Creates a copy of this rectangle.

Returns:

Rect

A new Rect with the same position and dimensions

Determines if a point is contained within this rectangle.

Parameters:pointany

The point to test

Returns:

boolean

True if the point is inside the rectangle, false otherwise

Creates an empty rectangle (zero position and dimensions).

Returns:

Rect

A new empty Rect instance

Determines if this rectangle is equal to another rectangle.

Parameters:rectany

The rectangle to compare with

Returns:

boolean

True if both rectangles have the same position and dimensions

Creates a rectangle from two points.

Parameters:pPoint

The first point

qPoint

The second point

Returns:

Rect

A new Rect with the two points as opposite corners

Inflates the rectangle by the specified amounts.

Parameters:dxany

The amount to inflate horizontally

dy?any

The amount to inflate vertically (defaults to dx if not provided)

Returns:

this

This rectangle instance for chaining

Determines if this rectangle is empty (zero width and height).

Returns:

boolean

True if the rectangle has no area, false otherwise

Gets the left center point of the rectangle.

Returns:

Point

A Point at the left center edge

Moves the rectangle by the specified offset.

Parameters:dxany

The horizontal offset (or a Point object)

dyany

The vertical offset (ignored if dx is a Point)

Returns:

this

This rectangle instance for chaining

Determines if this rectangle overlaps with another rectangle.

Parameters:rectany

The rectangle to check for overlap

Returns:

boolean

True if the rectangles overlap, false otherwise

Gets the right center point of the rectangle.

Returns:

Point

A Point at the right center edge

Calculates the bounding rectangle after rotating this rectangle by a given angle.

Parameters:angleany

The rotation angle in radians

Returns:

Rect

A new Rect representing the axis-aligned bounding box of the rotated rectangle

Gets the four corner points of this rectangle after rotation.

Parameters:angleany

The rotation angle in radians

Returns:

Point[]

An array of four Points representing the rotated corners [topLeft, topRight, bottomRight, bottomLeft]

Scales this rectangle while maintaining a static reference point.

Parameters:scaleXany

The horizontal scale factor

scaleYany

The vertical scale factor

staicPointany

The static point that should remain fixed during scaling

adornerCenterany

The center point of the adorner

angleany

The rotation angle to apply during scaling

Gets the top center point of the rectangle.

Returns:

Point

A Point at the top center edge

Gets the top-left corner point of the rectangle.

Returns:

Point

A Point at the top-left corner

Gets the top-right corner point of the rectangle.

Returns:

Point

A Point at the top-right corner

Converts an object to a Rect instance.

Parameters:rectany

The object to convert (if not already a Rect)

Returns:

Rect

A Rect instance

Returns a string representation of this rectangle.

Parameters:delimiterany

The delimiter to use between values (defaults to space)

Returns:

any

A string in the format "x y width height" (or with custom delimiter)

Creates a new rectangle that is the union of this rectangle and another.

Parameters:rany

The rectangle to union with

Returns:

Rect

A new Rect representing the union of both rectangles

Scales this rectangle by a zoom factor.

Parameters:zoomany

The zoom factor to apply

Returns:

this

This rectangle instance for chaining

Properties

height

number

The height of the rectangle

width

number

The width of the rectangle

x

number

The x-coordinate of the rectangle's top-left corner

y

number

The y-coordinate of the rectangle's top-left corner