This class defines a rectangle and provides utility methods for it.
Type Details
- yfiles module
- algorithms
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.algorithms.YRectangle
Constructors
Creates a new rectangle with given upper left corner and size.
Parameters
A map of options to pass to the method.
- pos - YPoint
- upper left corner of the rectangle.
- size - YDimension
- size of the rectangle.
Creates a new rectangle with given upper left corner and size.
Parameters
A map of options to pass to the method.
- x - number
- x-coordinate of upper left corner of the rectangle.
- y - number
- y-coordinate of upper left corner of the rectangle.
- width - number
- width of the rectangle.
- height - number
- height of the rectangle.
Properties
Gets this object.
Implements
Gets the height of the dimension object.
Defined in
Gets coordinates of upper left corner.
Gets the width of the dimension object.
Defined in
Methods
Compares this object to the given object of the same type.
Parameters
A map of options to pass to the method.
- o - Object
- The object to compare this to.
Returns
- ↪number
- -1: this is less than
obj
- 0: this is equal to
obj
- 1: this is greater than
obj
- -1: this is less than
Overrides
Checks whether or not this YRectangle
contains the given point.
Parameters
A map of options to pass to the method.
- x - number
- the x-coordinate of the point to check.
- y - number
- the x-coordinate of the point to check.
Returns
- ↪boolean
true
if the point lies inside the rectangle;false
otherwise.
Checks whether or not this YRectangle
contains the given point.
Checks whether or not this YRectangle
contains the given rectangle.
Tests a dimension to equality to another dimension.
Overrides
Returns the Euclidean distance to the passed rectangle.
Remarks
Parameters
A map of options to pass to the method.
- other - YRectangle
- the second rectangle.
Returns
- ↪number
- the distance to the given rectangle.
Returns the Manhattan distance to the passed rectangle.
Remarks
Parameters
A map of options to pass to the method.
- other - YRectangle
- the second rectangle.
Returns
- ↪number
- the distance to the given rectangle.
Returns a hash code for this object.
Remarks
The hash code is a numeric value that can be used to treat this object as a key in a hash table or similar data structure.
Two objects that are considered equal must have the same hash code. However, the reverse does not hold and two objects having the same hash code don't have to be equal. Ideally, the hash code should be roughly uniformly-distributed to prevent hash tables from performing poorly. Calculating the hash code is also a potentially frequent operation and should therefore be fast.
Returns
- ↪number
- the hash code for this object
Overrides
Creates a Rect from a given YRectangle.
Returns
Class.ensure(LayoutExecutor)
More information.Creates a Size from a given YDimension.
Returns
Class.ensure(LayoutExecutor)
More information.Defined in
Returns a string representation of this rectangle
Overrides
Static Methods
contains
(rx: number, ry: number, rw: number, rh: number, x: number, y: number, closed?: boolean) : booleanDetermines whether the specified rectangle contains the specified point.
Parameters
A map of options to pass to the method.
- rx - number
- the x-coordinate of the upper left corner of the rectangle.
- ry - number
- the y-coordinate of the upper left corner of the rectangle.
- rw - number
- the width of the rectangle.
- rh - number
- the height of the rectangle.
- x - number
- the x-coordinate of the point to check.
- y - number
- the x-coordinate of the point to check.
- closed - boolean
- if
true
, all points on the border of the rectangle are considered to be contained, otherwise, points on the top and left borders are considered to be contained while points on the bottom and right borders are not (this behavior matches contains).
Returns
- ↪boolean
true
if the point lies inside the rectangle;false
otherwise.
Returns whether or not the given rectangles intersect.