Class: Size

Size(width, height)

The Size type is used to describe the size of something. It has a height and width property which are the sizes in pixels.

Constructor

new Size(width, height)

Create a size with pixel dimensions. Same as calling fromPx.
Parameters:
Name Type Description
width number the width in pixels.
height number the height in pixels.
Source:

Classes

Size

Members

(static) paperA3

DIN-A3 paper size. 297x420mm
Source:

(static) paperA4

DIN-A4 paper size. 210x297mm
Source:

(static) paperA5

DIN-A5 paper size. 148x210mm
Source:

(static) paperA6

DIN-A6 paper size. 105x148mm
Source:

(static) paperA7

DIN-A7 paper size. 74x105mm
Source:

(static) paperCarreL

Carre L - quadratic A4 paper size. 210x210mm
Source:

(static) paperHalfLetter

North american half letter size. 5.5x8.5in
Source:

(static) paperLetter

North american letter size. 8.5x11in
Source:

(static) paperPostcard

North american postcard paper size. 101.6x152.4mm
Source:

(static) zero

Zero size. 0x0 pixels.
Source:

height

The height in pixels.
Source:

height

Set the height in pixels.
Source:

width

The width in pixels.
Source:

width

Set the size in pixels.
Source:

Methods

(static) fromInches(width, height) → {Size}

Create a new size with inch dimensions. Uses the default CSS spec 96 pixels-per-inch.
Parameters:
Name Type Description
width number the width in inches
height number the height in inches
Source:
Returns:
Type
Size

(static) fromMillimeters(width, height) → {Size}

Create a size with millimeter dimensions. Uses the default CSS spec 96 pixels-per-inch.
Parameters:
Name Type Description
width number the width in millimeters
height number the height in millimeters
Source:
Returns:
Type
Size

(static) fromPx(width, height) → {Size}

Create a size with pixel dimensions. Same as calling the constructor.
Parameters:
Name Type Description
width number the width in pixels
height number the height in pixel
Source:
Returns:
Type
Size

(static) max(size1, size2) → {Size}

Returns a new size with the largest width and largest height of the two supplied sizes.
Parameters:
Name Type Description
size1 Size the first size
size2 Size the second size
Source:
Returns:
Type
Size

(static) min(size1, size2) → {Size}

Returns a new size with the smallest width and smallest height of the two supplied sizes.
Parameters:
Name Type Description
size1 Size first size
size2 Size second size
Source:
Returns:
Type
Size

(static) random() → {Size}

Creates a new size with a random width and height between 0 and 1.
Source:
Returns:
Type
Size

landscape() → {Size}

Turn the size landscape. This makes the shorter dimensions the width and the longer dimensions the height.
Source:
Returns:
Type
Size

portrait() → {Size}

Turn the size portrait. This makes the longer dimension the height and the shorter dimension the width.
Source:
Returns:
Type
Size