Class Margin

A Margin represents a band of space outside or inside a rectangular area, with possibly different values on each of the four sides.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): Margin

If zero arguments are supplied, zero is used for all four sides.

Returns

Margin

constructor(m: number): Margin

If one argument is supplied, that number is used for all four sides.

Parameters

  • m: number

    the margin for all four sides.

Returns

Margin

constructor(tb: number, rl: number): Margin

If two arguments are supplied, the top and bottom sides get the first value, and the left and right sides get the second value.

Parameters

  • tb: number

    the margin for the top and bottom sides

  • rl: number

    the margin for the right and left sides

Returns

Margin

constructor(t: number, r: number, b: number, l: number): Margin

If there are four arguments, the numbers represent: top, right, bottom, left.

Parameters

  • t: number

    the margin for the top side; if not supplied, all sides are zero.

  • r: number

    the margin for the right side; if not supplied, all sides have the value of the first argument.

  • b: number

    the margin for all bottom side; if not supplied, the top and bottom get the value of the first argument, and the right and left sides get the value of the second argument.

  • l: number

    the margin for the left side; must be supplied if the third argument was supplied.

Returns

Margin

Properties

public bottom: number

Gets or sets the bottom value of this margin.

public left: number

Gets or sets the left value of this margin.

public right: number

Gets or sets the right value of this margin.

public top: number

Gets or sets the top value of this margin.

Methods

public copy(): Margin

Create a copy of this Margin, with the same values.

Returns

Margin

public equalTo(t: number, r: number, b: number, l: number): boolean

Indicates whether the given margin is equal to this Margin.

Parameters

  • t: number

    top.

  • r: number

    right.

  • b: number

    bottom.

  • l: number

    left.

Returns

boolean

public equals(m: Margin): boolean

Indicates whether the given Margin is equal to this Margin.

Parameters

  • m: Margin

    The Margin to compare to this Margin.

Returns

boolean

public isReal(): boolean

True if this Margin has values that are real numbers and not infinity.

Returns

boolean

public static parse(str: string): Margin

This static method can be used to read in a Margin from a string that was produced by Margin.stringify.

Parameters

  • str: string

Returns

Margin

public set(m: Margin): Margin

Replace the transformation matrix of this Transform with those of another Transform.

Parameters

Returns

Margin

public setTo(t: number, r: number, b: number, l: number): Margin

Modify this Size with new Width and Height values.

Parameters

  • t: number
  • r: number
  • b: number
  • l: number

Returns

Margin

public static stringify(val: Margin): string

This static method can be used to write out a Margin as a string that can be read by Margin.parse.

Parameters

Returns

string