GeezerVison is showing maxgraph.github.io — Rectangle | @maxgraph/core
Extends Point to implement a 2-dimensional rectangle with double precision coordinates.
Constructors
constructor
-
new Rectangle( x?: number, y?: number, width?: number, height?: number,): Rectangle
Constructs a new rectangle for the optional parameters.
Parameters
- x: number = 0
- y: number = 0
- width: number = 0
- height: number = 0
Returns Rectangle
Properties
_height
_height: number = 0
Holds the height of the rectangle.
_width
_width: number = 0
Holds the width of the rectangle.
_x
_x: number = 0
Holds the x-coordinate of the point. Default is 0.
_y
_y: number = 0
Holds the y-coordinate of the point. Default is 0.
Accessors
x
-
get x(): number
-
set x(x: number): void
y
-
get y(): number
-
set y(y: number): void
Methods
add
-
add(rect: Rectangle
): void
Adds the given rectangle to this rectangle.
Returns void
clone
-
Returns a clone of this Point.
Returns Rectangle
equals
-
equals(rect: Rectangle
| null): boolean
Returns true if the given object equals this rectangle.
Returns boolean
getCenterX
-
Returns the x-coordinate of the center point.
Returns number
getCenterY
-
Returns the y-coordinate of the center point.
Returns number
getPoint
-
Returns the top, left corner as a new Point.
grow
-
grow(amount: number): void
Grows the rectangle by the given amount, that is, this method subtracts
the given amount from the x- and y-coordinates and adds twice the amount
to the width and height.
Returns void
intersect
-
intersect(rect: Rectangle
): void
Changes this rectangle to where it overlaps with the given rectangle.
Returns void
rotate90
-
Rotates this rectangle by 90 degree around its center point.
Returns void
setRect
-
setRect(x: number, y: number, width: number, height: number): void
Sets this rectangle to the specified values
Parameters
- x: number
- y: number
- width: number
- height: number
Returns void
StaticfromRectangle
-
fromRectangle(rect: Rectangle
): Rectangle
Returns a new Rectangle which is a copy of the given rectangle.
Returns Rectangle
On This Page
Constructors
Properties
Accessors
Methods