Interface for rectangles aligned to the axes in 2D coordinate space with double precision coordinates.
Remarks
This interface provides read access to the features of the rectangle only, however this does not mean that an instance that implements IRectangle
will always return the same values for its properties. Often times the instance provides dynamic read access to the current state of a rectangle. It depends on the context whether it is allowed or even necessary to copy the state of the properties or whether the reference to the instance should always be used to query the values. This interface does not declare any additional methods. It combines the IPoint interface that describes the upper left corner of the rectangle with the ISize interface that describes the width and height of the rectangle.
This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.
It is possible to specify an Array or plain Object to define the Rect:
[5, 5, 20, 20] // x, y, width, height
{ x: 5, y: 5, width: 20, height: 20 }
Type Details
- yFiles module
- core
See Also
Properties
Gets the current height of this instance.
Gets the maximum x-coordinate of the rectangle.
Remarks
Gets the maximum y-coordinate of the rectangle.
Remarks
Gets the current width of this instance.
Methods
Determines whether the given rectangle contains the provided point.
Parameters
A map of options to pass to the method.
- point - IPoint
- The point to test.
- eps - number
- A positive value allows for fuzzy hit testing. If the point lies outside the given object but its distance is less than or equal to that value, it will be considered a hit.
Returns
- ↪boolean
true
iff the point lies inside the rectangle.
Determines whether the given rectangle contains the provided rectangle.
Remarks
More formally, this rectangle contains the other rectangle if the coordinates of each point of the other rectangle are neither less than this rectangle's x and y minus eps
nor greater than this rectangle's MaxX and MaxY plus eps
.
Consequently, an empty rectangle neither contains any other rectangle nor is it contained in any other rectangle.
Note, the result of this method can be counterintuitive if this rectangle's x or y is positive or negative infinity.
Parameters
A map of options to pass to the method.
- other - IRectangle
- The rectangle to test.
- eps - number
- A positive value allows for fuzzy hit testing.
Returns
- ↪boolean
true
if the given rectangle contains the provided rectangle,false
otherwise.
Static Methods
Creates a Rect instance from the given rectangle-like object by performing automatic type conversion.