AWT. Dimension

This class encapsulates width and height properties.

Constructor

new Dimension(w, h)

Dimension constructor

Parameters:
NameTypeDescription
wnumber | Point

The width of this Dimension, or the upper-left vertex of a
virtual Rectangle

hnumber | Point

The height of this Dimension, or the bottom-right vertex of a
virtual Rectangle

Members

height :number

Type:
  • number

width :number

Type:
  • number

Methods

equals(d) → {boolean}

Check if two dimensions are equivalent

Parameters:
NameTypeDescription
dmodule:AWT.Dimension
Returns:
Type: 
boolean

getAttributes() → {object}

Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.

Returns:
  • The resulting object, with minimal attrributes
Type: 
object

getSurface() → {number}

Calculates the area of a Rectangle with this dimension

Returns:

The resulting area

Type: 
number

multBy(delta) → {module:AWT.Dimension}

Multiplies the w and h co-ordinates by a specified delta

Parameters:
NameTypeDescription
deltaPoint | Dimension
Returns:
Type: 
module:AWT.Dimension

setAttributes(data) → {module:AWT.Dimension}

Reads the properties of this Dimension from a data object

Parameters:
NameTypeDescription
dataobject

The data object to be parsed

Returns:
Type: 
module:AWT.Dimension

setDimension(width, heightopt) → {module:AWT.Dimension}

Sets new values for width and height.
width can be a number or another Dimension object

Parameters:
NameTypeAttributesDescription
widthnumber | Dimension

The new width, or a full Dimension to copy it from.

heightnumber<optional>

Not used when width is a Dimension

Returns:
Type: 
module:AWT.Dimension

setProperties($xml) → {module:AWT.Dimension}

Reads the properties of this Dimension from an XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The xml element to be parsed

Returns:
Type: 
module:AWT.Dimension