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.
Gets or sets the Point at the center of this Rect. Setting this property just shifts the X and Y values.
Gets or sets the horizontal center X coordinate of the Rect.
Gets or sets the vertical center Y coordinate of the Rect.
Gets or sets the height of the Rect. The value must not be negative.
Gets or sets the leftmost value of the Rect. This is the same as the X value.
Gets or sets the x- and y-axis position of the Rect as a Point.
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.
Gets or sets the width and height of the Rect as a Size.
Gets or sets the topmost value of the Rect. This is the same as the Y value.
Gets or sets the width of the Rect. The value must not be negative.
Gets or sets the top-left x coordinate of the Rect.
Gets or sets the top-left y coordinate of the Rect.
Indicates whether this Rect contains the given Point/Rect.
The X coordinate of the Point or Rect to include in the new bounds.
The Y coordinate of the Point or Rect to include in the new bounds.
Optional
w: numberThe Width of the Rect to include in the new bounds, defaults to zero.
Optional
h: numberThe Height of the Rect to include in the new bounds, defaults to zero.
True if the Point/Rect is contained within this Rect, false otherwise.
Virtual
copyModifies this Rect by adding some distance to each side of the Rect.
the amount to move the top side upwards; may be negative.
the amount to move the right side rightwards; may be negative.
the amount to move the bottom side downwards; may be negative.
the amount to move the left side leftwards; may be negative.
this modified 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.
The additional width on each side, left and right; may be negative.
The additional height on each side, top and bottom; may be negative.
this.
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.
The result is meaningless if Spot.isNoSpot is true.
the point where the spot should be.
the point where the spot should be.
a Spot; Spot.isSpot must be true.
this.
Modify this Rect to be exactly big enough to contain both the original Rect and the given rectangular area.
The X coordinate of the Point or Rect to include in the new bounds.
The Y coordinate of the Point or Rect to include in the new bounds.
Optional
w: numberThe Width of the Rect to include in the new bounds, defaults to zero.
Optional
h: numberThe Height of the Rect to include in the new bounds, defaults to zero.
this.
Static
containsThis static function indicates whether a Rect contains the given Point/Rect.
The X coordinate of a Rect.
The Y coordinate of a Rect.
The Width of a Rect.
The Height of a Rect.
The X coordinate of the Point or Rect that might be in the bounds (RX, RY, RW, RH).
The Y coordinate of the Point or Rect that might be in the bounds (RX, RY, RW, RH).
Optional
w: numberThe Width of the Rect to include in the new bounds, defaults to zero.
Optional
h: numberThe Height of the Rect to include in the new bounds, defaults to zero.
True if the Point/Rect is contained within this Rect, false otherwise.
Static
intersectsThis static function indicates whether a Rect partly or wholly overlaps the given Rect.
The X coordinate of a Rect.
The Y coordinate of a Rect.
The Width of a Rect.
The Height of a Rect.
The X coordinate of the Point or Rect that might overlap the bounds (RX, RY, RW, RH).
The Y coordinate of the Point or Rect that might overlap the bounds (RX, RY, RW, RH).
true if there is any overlap.
Static
intersectsThis static function is true if a rectangular area is intersected by a finite straight line segment.
The X coordinate of the rectangle to check for intersection with the line segment.
The Y coordinate of the rectangle to check for intersection with the line segment.
The Width of the rectangle to check for intersection with the line segment.
The Height of the rectangle to check for intersection with the line segment.
The X coordinate of one end of the line segment.
The Y coordinate of one end of the line segment.
The X coordinate of other end of the line segment.
The Y coordinate of other end of the line segment.
True if the given finite line segment intersects with the given rectangular area, false otherwise.
Static
parseThis static function can be used to read in a Rect from a string that was produced by Rect.stringify.
go.Rect.parse("1 2 3 4")
produces the Rect new go.Rect(1, 2, 3, 4)
.
Static
stringifyThis static function can be used to write out a Rect as a string that can be read by Rect.parse.
go.Rect.stringify(new go.Rect(1, 2, 3, 4))
produces the string "1 2 3 4".
Static
stringifyThis static function returns a function that can be used as a back converter for a Binding to write out a Rect's values as numbers with a fixed number of digits after the decimal point.
This is useful for limiting the size of JSON output and making it more legible. It might also be useful for regression testing.
must be a non-negative integer
a function that converts a Rect to a string without so many decimals
This static function returns a function that can be used as a back converter for a Binding to write out a Rect's values as numbers with a fixed number of digits after the decimal point.
This is useful for limiting the size of JSON output and making it more legible. It might also be useful for regression testing.
a function that converts a Rect to a string without so many decimals
A Rect describes a rectangular two-dimensional area as a top-left point (x and y values) and a size (width and height values).
Use the static functions Rect.parse and Rect.stringify to convert to and from a standard string representation that is independent of the current locale.
When an instance of this class is the value of a property of a GraphObject class or Diagram or CommandHandler or a Tool class, you should treat the object as if it were frozen or read-only -- you cannot modify its properties. This allows the property to return a value without allocating a new instance. If you need to do your own calculations with the value, call copy to make a new instance with the same values that you can modify.
Many methods modify the object's properties and then return a reference to "this" object. The only instance method to allocate a new object is the copy method. The static Rect.parse method also allocates a new object. The center, position, and size properties all allocate and return a new object.
The "Debug" implementation of this class is significantly slower than the "Release" implementation, mostly due to additional error checking.
You cannot inherit from this class.