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

Inheritance

Constructor

goog.math.Size(widthheight)

Parameters

width : number
Width.
height : number
Height.

Instance Methods

Public Protected Private
Defined in goog.math.Size
area() number
No description.
Returns: number  The area of the size (width * height).
code »
aspectRatio() number
No description.
Returns: number  The ratio of the size's width to its height.
code »
ceil() !goog.math.Size
Clamps the width and height parameters upward to integer values.
Returns: !goog.math.Size  This size with ceil'd components.
code »
clone() !goog.math.Size
No description.
Returns: !goog.math.Size  A new copy of the Size.
code »
fitsInside(target) boolean
No description.
Arguments:
target : !goog.math.Size
The target size.
Returns: boolean  True if this Size is the same size or smaller than the target size in both dimensions.
code »
floor() !goog.math.Size
Clamps the width and height parameters downward to integer values.
Returns: !goog.math.Size  This size with floored components.
code »
getLongest() number
No description.
Returns: number  The longer of the two dimensions in the size.
code »
getShortest() number
No description.
Returns: number  The shorter of the two dimensions in the size.
code »
isEmpty() boolean
No description.
Returns: boolean  True if the size has zero area, false if both dimensions are non-zero numbers.
code »
perimeter() number
No description.
Returns: number  The perimeter of the size (width + height) * 2.
code »
round() !goog.math.Size
Rounds the width and height parameters to integer values.
Returns: !goog.math.Size  This size with rounded components.
code »
scale(sxopt_sy) !goog.math.Size
Scales this size by the given scale factors. The width and height are scaled by sx and opt_sy respectively. If opt_sy is not given, then sx is used for both the width and height.
Arguments:
sx : number
The scale factor to use for the width.
opt_sy : number=
The scale factor to use for the height.
Returns: !goog.math.Size  This Size object after scaling.
code »
scaleToFit(target) !goog.math.Size
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 : !goog.math.Size
The target size.
Returns: !goog.math.Size  This Size object, after optional scaling.
code »
toString() string
Returns a nice string representing size.
Returns: string  In the form (50 x 73).
code »

Instance Properties

Defined in goog.math.Size
height :
Height
Code »
width :
Width
Code »

Static Methods

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

Package math

Package Reference