Skip to main content

Seadragon.Rect class

Version 0.8.8 - Back to Seadragon Ajax API Reference

Overview

A class that represents a rectangle.

Constructors

SignatureDescription
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

NameTypeDescription
xNumberThe left edge of the rectangle.
yNumberThe top edge of the rectangle.
widthNumberThe width of the rectangle.
heightNumberThe height of the rectangle.

Methods

Name and SignatureReturn TypeDescription
getAspectRatio()NumberReturns this rectangle's aspect ratio (width / height).
getTopLeft() Seadragon.PointReturns (x, y) as a Seadragon.Point.
getBottomRight() Seadragon.PointReturns (x + width, y + height) as a Seadragon.Point.
getCenter() Seadragon.PointReturns (x + 0.5 * width, y + 0.5 * height) as a Seadragon.Point.
getSize() Seadragon.PointReturns (width, height) as a Seadragon.Point.
equals(rect)BooleanReturns true if this rectangle has the same x, y, width and height as the given rectangle.