Rectangle
The Rectangle class represents an abstract rectangular area. It is different from a rectangle mark.
Properties
property | explanation | type | default value |
---|---|---|---|
left | the x coordinate of the left hand side of the rectangle | Number | |
top | the y coordinate of the top of the rectangle | Number | |
right | the x coordinate of the right hand side of the rectangle | Number | |
bottom | the y coordinate of the bottom of the rectangle | Number | |
center | the x coordinate of the center of the rectangle | Number | |
middle | the y coordinate of the center of the rectangle | Number | |
x | the x coordinate of the center of the rectangle same as “center” | Number | |
y | the y coordinate of the center of the rectangle same as “middle” | Number | |
width | the width of the rectangle | Number | |
height | the height of the rectangle | Number |
Methods
method | explanation | return type | |
---|---|---|---|
contains(x, y) | check if a point with the specified x and y coordinates (type Number) is inside this rectangle | Boolean | |
union(rect) | returns the union of this rectangle and the parameter rect (type Rectangle) | Rectangle | |
clone() | returns a copy of this rectangle | Rectangle |