Members | Methods |
---|---|
Constructor
new Rect(xopt, yopt, widthopt, heightopt, degreesopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
Number |
<optional> |
0 | The vector component 'x'. |
y |
Number |
<optional> |
0 | The vector component 'y'. |
width |
Number |
<optional> |
0 | The vector component 'width'. |
height |
Number |
<optional> |
0 | The vector component 'height'. |
degrees |
Number |
<optional> |
0 | Rotation of the rectangle around (x,y) in degrees. |
- Source:
Members
degrees :Number
The rotation of the rectangle, in degrees.
Type:
- Number
- Source:
height :Number
The vector component 'height'.
Type:
- Number
- Source:
width :Number
The vector component 'width'.
Type:
- Number
- Source:
x :Number
The vector component 'x'.
Type:
- Number
- Source:
y :Number
The vector component 'y'.
Type:
- Number
- Source:
Methods
clone() → {OpenSeadragon.Rect}
- Source:
Returns:
a duplicate of this Rect
- Type
- OpenSeadragon.Rect
containsPoint(point, epsilonopt) → {Boolean}
Determines whether a point is inside this rectangle (edge included).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
point |
OpenSeadragon.Point | |||
epsilon |
Number |
<optional> |
0 | the margin of error allowed |
- Source:
Returns:
true if the point is inside this rectangle, false
otherwise.
- Type
- Boolean
equals(rectangle) → {Boolean}
Determines if two Rectangles have equivalent components.
Parameters:
Name | Type | Description |
---|---|---|
rectangle |
OpenSeadragon.Rect | The Rectangle to compare to. |
- Source:
Returns:
'true' if all components are equal, otherwise 'false'.
- Type
- Boolean
getAspectRatio() → {Number}
The aspect ratio is simply the ratio of width to height.
- Source:
Returns:
The ratio of width to height.
- Type
- Number
getBottomLeft() → {OpenSeadragon.Point}
Provides the coordinates of the bottom-left corner of the rectangle as a
point.
- Source:
Returns:
The coordinate of the bottom-left corner of
the rectangle.
- Type
- OpenSeadragon.Point
getBottomRight() → {OpenSeadragon.Point}
Provides the coordinates of the bottom-right corner of the rectangle as a
point.
- Source:
Returns:
The coordinate of the bottom-right corner of
the rectangle.
- Type
- OpenSeadragon.Point
getBoundingBox() → {OpenSeadragon.Rect}
Retrieves the smallest horizontal (degrees=0) rectangle which contains
this rectangle.
- Source:
Returns:
- Type
- OpenSeadragon.Rect
getCenter() → {OpenSeadragon.Point}
Computes the center of the rectangle.
- Source:
Returns:
The center of the rectangle as represented
as represented by a 2-dimensional vector (x,y)
- Type
- OpenSeadragon.Point
getIntegerBoundingBox() → {OpenSeadragon.Rect}
Retrieves the smallest horizontal (degrees=0) rectangle which contains
this rectangle and has integers x, y, width and height
- Source:
Returns:
- Type
- OpenSeadragon.Rect
getSize() → {OpenSeadragon.Point}
Returns the width and height component as a vector OpenSeadragon.Point
- Source:
Returns:
The 2 dimensional vector representing the
width and height of the rectangle.
- Type
- OpenSeadragon.Point
getTopLeft() → {OpenSeadragon.Point}
Provides the coordinates of the upper-left corner of the rectangle as a
point.
- Source:
Returns:
The coordinate of the upper-left corner of
the rectangle.
- Type
- OpenSeadragon.Point
getTopRight() → {OpenSeadragon.Point}
Provides the coordinates of the top-right corner of the rectangle as a
point.
- Source:
Returns:
The coordinate of the top-right corner of
the rectangle.
- Type
- OpenSeadragon.Point
intersection(rect) → {OpenSeadragon.Rect}
Returns the bounding box of the intersection of this rectangle with the
given rectangle.
Parameters:
Name | Type | Description |
---|---|---|
rect |
OpenSeadragon.Rect |
- Source:
Returns:
the bounding box of the intersection
or null if the rectangles don't intersect.
- Type
- OpenSeadragon.Rect
rotate(degrees, pivotopt) → {OpenSeadragon.Rect}
Rotates a rectangle around a point.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
degrees |
Number | The angle in degrees to rotate. | |
pivot |
OpenSeadragon.Point |
<optional> |
The point about which to rotate. Defaults to the center of the rectangle. |
- Source:
Returns:
- Type
- OpenSeadragon.Rect
times(factor) → {OpenSeadragon.Rect}
Multiply all dimensions (except degrees) in this Rect by a factor and
return a new Rect.
Parameters:
Name | Type | Description |
---|---|---|
factor |
Number | The factor to multiply vector components. |
- Source:
Returns:
A new rect representing the multiplication
of the vector components by the factor
- Type
- OpenSeadragon.Rect
toString() → {String}
Provides a string representation of the rectangle which is useful for
debugging.
- Source:
Returns:
A string representation of the rectangle.
- Type
- String
translate(delta) → {OpenSeadragon.Rect}
Translate/move this Rect by a vector and return new Rect.
Parameters:
Name | Type | Description |
---|---|---|
delta |
OpenSeadragon.Point | The translation vector. |
- Source:
Returns:
A new rect with altered position
- Type
- OpenSeadragon.Rect
union(rect) → {OpenSeadragon.Rect}
Returns the smallest rectangle that will contain this and the given
rectangle bounding boxes.
Parameters:
Name | Type | Description |
---|---|---|
rect |
OpenSeadragon.Rect |
- Source:
Returns:
The new rectangle.
- Type
- OpenSeadragon.Rect