New to Kendo UI for Angular? Start a free 30-day trial
Represents a rectangle with position and dimensions.
Provides methods for geometric operations and transformations.
Name | Type | Default | Description |
---|
|
number
|
|
|
number
|
|
|
number
|
|
|
number
|
|
(x?: number, y?: number, width?: number, height?: number)
Creates a new Rect instance.
number
The x-coordinate of the top-left corner (defaults to 0)
number
The y-coordinate of the top-left corner (defaults to 0)
number
The width of the rectangle (defaults to 0)
number
The height of the rectangle (defaults to 0)
|
---|
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 | | |
---|
point
|
any
|
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 | | |
---|
rect
|
any
|
The rectangle to compare with
|
|
Returns | |
---|
boolean
|
True if both rectangles have the same position and dimensions
|
|
|
---|
Creates a rectangle from two points.
|
Parameters | | |
---|
p
|
Point
|
The first point
|
q
|
Point
|
The second point
|
|
Returns | |
---|
Rect
|
A new Rect with the two points as opposite corners
|
|
|
---|
Inflates the rectangle by the specified amounts.
|
Parameters | | |
---|
dx
|
any
|
The amount to inflate horizontally
|
dy?
|
any
|
The amount to inflate vertically (defaults to dx if not provided)
|
|
Returns | |
---|
Rect
|
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 | | |
---|
dx
|
any
|
The horizontal offset (or a Point object)
|
dy
|
any
|
The vertical offset (ignored if dx is a Point)
|
|
Returns | |
---|
Rect
|
This rectangle instance for chaining
|
|
|
---|
Determines if this rectangle overlaps with another rectangle.
|
Parameters | | |
---|
rect
|
any
|
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 | | |
---|
angle
|
any
|
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 | | |
---|
angle
|
any
|
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 | | |
---|
scaleX
|
any
|
The horizontal scale factor
|
scaleY
|
any
|
The vertical scale factor
|
staicPoint
|
any
|
The static point that should remain fixed during scaling
|
adornerCenter
|
any
|
The center point of the adorner
|
angle
|
any
|
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 | | |
---|
rect
|
any
|
The object to convert (if not already a Rect)
|
|
Returns | |
---|
Rect
|
A Rect instance
|
|
|
---|
Returns a string representation of this rectangle.
|
Parameters | | |
---|
delimiter
|
any
|
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 | | |
---|
r
|
any
|
The rectangle to union with
|
|
Returns | |
---|
Rect
|
A new Rect representing the union of both rectangles
|
|
|
---|
Scales this rectangle by a zoom factor.
|
Parameters | | |
---|
zoom
|
any
|
The zoom factor to apply
|
|
Returns | |
---|
Rect
|
This rectangle instance for chaining
|
|