Class: Rect

Annotations. Rect

Represents a utility class used to manipulate rectangle objects.


new Rect(x1, y1, x2, y2)

Create a new Rect with the x and y coordinates of the upper-left and lower right points.

Parameters:
Name Type Description
x1 number

the x coordinate of the upper-left point

y1 number

the y coordinate of the upper-left point

x2 number

the x coordinate of the lower-right point

y2 number

the y coordinate of the lower-right point

Example
(x1,y1)------|
    |        |
    |------(x2,y2)

Methods


exportNormalize()

Normalizes the rect to ensure point (x1, y1) is the bottom left point as expected by xfdf output


fitTo(rect)

Best fit this rect into another larger rect

Parameters:
Name Type Description
rect Annotations.Rect

getHeight()

Gets the height of the rect

Returns:

The height of the rect

Type
number

getWidth()

Gets the width of the rect

Returns:

The width of the rect

Type
number

normalize()

Normalizes the rect to ensure point (x1, y1) is the upper left point and width and height are non-negative.


translate(x, y)

Translates the rect

Parameters:
Name Type Description
x number

The amount to translate in the x direction

y number

The amount to translate in the y direction