Dimension

Source: AWT.js:711

This class encapsulates width and height properties.


Constructor

new Dimension(w: number | Point, h: number | Point): Dimension

Dimension constructor

Parameters

  • w (number | Point) — The width of this Dimension, or the upper-left vertex of a
    virtual Rectangle
  • h (number | Point) — The height of this Dimension, or the bottom-right vertex of a
    virtual Rectangle

Instance Methods

setProperties($xml: external:jQuery): module:AWT.Dimension

Reads the properties of this Dimension from an XML element

Parameters

Returns

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

  • object

setAttributes(data: object): module:AWT.Dimension

Reads the properties of this Dimension from a data object

Parameters

  • data (object) — The data object to be parsed

Returns

equals(d: module:AWT.Dimension): boolean

Check if two dimensions are equivalent

Parameters

Returns

  • boolean

multBy(delta: Point | Dimension): module:AWT.Dimension

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

Parameters

Returns

setDimension( width: number | Dimension, height?: number, ): module:AWT.Dimension

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

Parameters

  • width (number | Dimension) — The new width, or a full Dimension to copy it from.
  • height (number, optional) — Not used when width is a Dimension

Returns

getSurface(): number

Calculates the area of a Rectangle with this dimension

Returns

  • number — The resulting area

Instance Fields

width: number

height: number