API

Class ValueAndUnit

Class used to specific a value and its associated unit

Index
  • Creates a new ValueAndUnit

    Parameters

    • value: number

      defines the value to store

    • unit: number = ValueAndUnit.UNITMODE_PIXEL

      defines the unit to store - defaults to ValueAndUnit.UNITMODE_PIXEL

    • negativeValueAllowed: boolean = true

      defines a boolean indicating if the value can be negative

    Returns ValueAndUnit

ignoreAdaptiveScaling: boolean = false

Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property

negativeValueAllowed: boolean = true

defines a boolean indicating if the value can be negative

onChangedObservable: any = ...

Observable event triggered each time the value or unit changes

UNITMODE_EM: 2

Font-relative units, resolved against the control's computed font size.

UNITMODE_REM: 3

Root-relative units, resolved against the GUI root container's computed font size.

  • Store a value parsed from a string

    Parameters

    • source: string | number

      defines the source string

    Returns boolean

    true if the value was successfully parsed and updated

  • Gets the value accordingly to its unit

    Parameters

    • host: AdvancedDynamicTexture

      defines the root host

    • OptionalfontSize: number

      defines the computed font size in pixels for em units

    • OptionalrootFontSize: number

      defines the computed root font size in pixels for rem units

    Returns number

    the value

  • Gets value as pixel

    Parameters

    • host: AdvancedDynamicTexture

      defines the root host

    • refValue: number

      defines the reference value for percentages

    • OptionalfontSize: number

      defines the computed font size in pixels for em units

    • OptionalrootFontSize: number

      defines the computed root font size in pixels for rem units

    Returns number

    the value as pixel