Rect$Typings extension

on

Properties

bottom num
Gets or sets the y-axis value of the bottom of the Rect. This is equal to the sum of the y value and the height.
getter/setter pair
center Point
Gets or sets the Point at the center of this Rect. Setting this property just shifts the X and Y values.
getter/setter pair
centerX num
Gets or sets the horizontal center X coordinate of the Rect.
getter/setter pair
centerY num
Gets or sets the vertical center Y coordinate of the Rect.
getter/setter pair
height num
Gets or sets the height of the Rect. The value must not be negative.
getter/setter pair
left num
Gets or sets the leftmost value of the Rect. This is the same as the X value.
getter/setter pair
position Point
Gets or sets the x- and y-axis position of the Rect as a Point.
getter/setter pair
Gets or sets the x-axis value of the right of the Rect. This is equal to the sum of the x value and the width.
getter/setter pair
size Size
Gets or sets the width and height of the Rect as a Size.
getter/setter pair
top num
Gets or sets the topmost value of the Rect. This is the same as the Y value.
getter/setter pair
width num
Gets or sets the width of the Rect. The value must not be negative.
getter/setter pair
x num
Gets or sets the top-left x coordinate of the Rect.
getter/setter pair
y num
Gets or sets the top-left y coordinate of the Rect.
getter/setter pair

Methods

addMargin(Margin m) Rect
Modify this Rect by adding the given Margin to each side of the Rect. @param {Margin} m The Margin to add to the Rect. @return {Rect} this bigger Rect. @see #subtractMargin @see #grow @see #inflate
contains(num x, num y, [num? w, num? h]) bool
Indicates whether this Rect contains the given Point/Rect. @param {number} x The X coordinate of the Point or Rect to include in the new bounds. @param {number} y The Y coordinate of the Point or Rect to include in the new bounds. @param {number=} w The Width of the Rect to include in the new bounds, defaults to zero. @param {number=} h The Height of the Rect to include in the new bounds, defaults to zero. @return {boolean} True if the Point/Rect is contained within this Rect, false otherwise. @see #containsRect @see #containsPoint
containsPoint(Point p) bool
Indicates whether this Rect contains the given Point. @param {Point} p The Point to check. @return {boolean} True if the Point is contained within this Rect, false otherwise. @see #containsRect @see #contains
containsRect(Rect r) bool
Indicates whether this Rect contains the given Rect. @param {Rect} r The Rect to check. @return {boolean} True if the Rect is contained within this Rect, false otherwise. @see #containsPoint @see #contains
copy() Rect
Create a copy of this Rect, with the same values. @expose @return {Rect}
equals(Rect r) bool
Indicates whether the given Rect is equal to the current Rect. @param {Rect} r The rectangle to compare to the current rectangle. @return {boolean} True if the Rects are equivalent in x, y, width, and height. @see #equalTo
equalsApprox(Rect r) bool
(undocumented) True when the given Rect is nearly equal to this Rect. @param {Rect} r The Rect to compare to the current Rect. @return {boolean} True if the two Rects have respective X, Y, Width, and Height values within 0.5, false otherwise.
equalTo(num x, num y, num w, num h) bool
Indicates whether the given Rect is equal to the current Rect. @param {number} x @param {number} y @param {number} w the width. @param {number} h the height. @return {boolean} True if the Rects are equivalent in x, y, width, and height. @see #equals
grow(num t, num r, num b, num l) Rect
Modifies this Rect by adding some distance to each side of the Rect. @param {number} t the amount to move the top side upwards; may be negative. @param {number} r the amount to move the right side rightwards; may be negative. @param {number} b the amount to move the bottom side downwards; may be negative. @param {number} l the amount to move the left side leftwards; may be negative. @return {Rect} this modified Rect. @see #inflate @see #addMargin @see #subtractMargin
inflate(num w, num h) Rect
Modify this Rect so that its width and height are changed on all four sides, equally on the left and right sides, and equally on the top and bottom sides. When the arguments are negative, this operation deflates this Rect, but not beyond zero. @param {number} w The additional width on each side, left and right; may be negative. @param {number} h The additional height on each side, top and bottom; may be negative. @return {Rect} this. @since 2.3 @see #grow @see #addMargin @see #subtractMargin
intersect(num x, num y, num w, num h) Rect
Modify this Rect so that it is the intersection of this Rect and the rectangle defined by x, y, w, h. @param {number} x @param {number} y @param {number} w @param {number} h @return {Rect} this. @see #intersectRect @see #intersects
intersectRect(Rect r) Rect
Modify this Rect so that it is the intersection of this Rect and the given Rect. @param {Rect} r Rect to intersect with. @return {Rect} this. @see #intersect @see #intersects
intersects(num x, num y, num w, num h) bool
Determine if this Rect partly or wholly overlaps the rectangle defined by x, y, w, h. @param {number} x @param {number} y @param {number} w @param {number} h @return {boolean} true if there is any overlap. @see #intersectsRect @see #intersect
intersectsRect(Rect r) bool
Determine if a given Rect is partly or wholly inside of this Rect. @param {Rect} r Rect to test intersection with. @return {boolean} true if there is an intersection. @see #intersects @see #intersectRect
isEmpty() bool
True if this Rect has a Width and Height of zero. @return {boolean}
isReal() bool
True if this Rect has X, Y, Width, and Height values that are real numbers and not infinity. @return {boolean}
offset(num dx, num dy) Rect
Modify this Rect by shifting its values with the given DX and DY offsets. @param {number} dx @param {number} dy @return {Rect} this.
set(Rect r) Rect
Modify this Rect so that its X, Y, Width, and Height values are the same as the given Rect. @param {Rect} r the given Rect. @return {Rect} this.
setPoint(Point p) Rect
Modify this Rect so that its X and Y values are the same as the given Point. @param {Point} p the given Point. @return {Rect} this.
setSize(Size s) Rect
Modify this Rect so that its Width and Height values are the same as the given Size. @param {Size} s the given Size. @return {Rect} this.
setSpot(num x, num y, Spot spot) Rect
Modify this Rect so that a given Spot is at a given (x,y) point using this Rect's size. Return this rectangle for which the spot is at that point, without modifying the size.
setTo(num x, num y, num w, num h) Rect
Modify this Rect with new X, Y, Width, and Height values. @param {number} x @param {number} y @param {number} w the width. @param {number} h the height. @return {Rect} this.
subtractMargin(Margin m) Rect
Modify this Rect by subtracting the given Margin from each side of the Rect. @param {Margin} m The Margin to subtract from the Rect. @return {Rect} this smaller Rect. @see #addMargin @see #grow @see #inflate
union(num x, num y, [num? w, num? h]) Rect
Modify this Rect to be exactly big enough to contain both the original Rect and the given rectangular area. @param {number} x The X coordinate of the Point or Rect to include in the new bounds. @param {number} y The Y coordinate of the Point or Rect to include in the new bounds. @param {number=} w The Width of the Rect to include in the new bounds, defaults to zero. @param {number=} h The Height of the Rect to include in the new bounds, defaults to zero. @return {Rect} this. @see #unionRect @see #unionPoint
unionPoint(Point p) Rect
Modify this Rect to be exactly big enough to contain both the original Rect and the given Point. @param {Point} p The Point to include in the new bounds. @return {Rect} this. @see #unionRect @see #union
unionRect(Rect r) Rect
Modify this Rect to be exactly big enough to contain this Rect and the given Rect. @param {Rect} r The Rect to include in the new bounds. @return {Rect} this. @see #unionPoint @see #union