math.Size Extends Object
Class for representing sizes consisting of a width and height. Undefined width and height support is deprecated and results in compiler warning.

Inheritance

Object
     goog.math.Size

Constructor

goog.math.Size(widthheight)

Parameters

width :
Width.
height :
Height.

Instance Methods

Public Protected Private
Defined in goog.math.Size
area()
No description.
Returns:   The area of the size (width * height).
code »
aspectRatio()
No description.
Returns:   The ratio of the size's width to its height.
code »
ceil()
Clamps the width and height parameters upward to integer values.
Returns:   This size with ceil'd components.
code »
clone()
No description.
Returns:   A new copy of the Size.
code »
fitsInside(target)
No description.
Arguments:
target :
The target size.
Returns:   True if this Size is the same size or smaller than the target size in both dimensions.
code »
floor()
Clamps the width and height parameters downward to integer values.
Returns:   This size with floored components.
code »
getLongest()
No description.
Returns:   The longer of the two dimensions in the size.
code »
getShortest()
No description.
Returns:   The shorter of the two dimensions in the size.
code »
isEmpty()
No description.
Returns:   True if the size has zero area, false if both dimensions are non-zero numbers.
code »
round()
Rounds the width and height parameters to integer values.
Returns:   This size with rounded components.
code »
scale(s)
Scales the size uniformly by a factor.
Arguments:
s :
The scale factor.
Returns:   This Size object after scaling.
code »
scaleToFit(target)
Uniformly scales the size to fit inside the dimensions of a given size. The original aspect ratio will be preserved. This function assumes that both Sizes contain strictly positive dimensions.
Arguments:
target :
The target size.
Returns:   This Size object, after optional scaling.
code »
toString()
Returns a nice string representing size.
Returns:   In the form (50 x 73).
code »

Static Methods

goog.math.Size.equals(ab)
Compares sizes for equality.
Arguments:
a :
A Size.
b :
A Size.
Returns:   True iff the sizes have equal widths and equal heights, or if both are null.
code »

Package math

Package Reference