Seadragon.Rect Class

Version - Back to Seadragon Ajax Library

Overview

A class that represents a rectangle.

Constructors

Signature Description
Seadragon.Rect() Creates a rectangle at (0, 0) of size 0 x 0.
Seadragon.Rect(x, y, width, height) Creates a rectangle at (x, y) of size width x height.

Properties

Name Type Description
x Number The left edge of the rectangle.
y Number The top edge of the rectangle.
width Number The width of the rectangle.
height Number The height of the rectangle.

Methods

Name and Signature Return Type Description
getAspectRatio() Number Returns this rectangle's aspect ratio (width / height).
getTopLeft() Seadragon.Point Returns (x, y) as a Seadragon.Point.
getBottomRight() Seadragon.Point Returns (x + width, y + height) as a Seadragon.Point.
getCenter() Seadragon.Point Returns (x + 0.5 * width, y + 0.5 * height) as a Seadragon.Point.
getSize() Seadragon.Point Returns (width, height) as a Seadragon.Point.
equals(rect) Boolean Returns true if this rectangle has the same x, y, width and height as the given rectangle.