Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to specific a value and its associated unit

Hierarchy

  • ValueAndUnit

Index

Constructors

  • new ValueAndUnit(value: number, unit?: number, negativeValueAllowed?: boolean): ValueAndUnit
  • Creates a new ValueAndUnit

    Parameters

    • value: number

      defines the value to store

    • Optional unit: number

      defines the unit to store - defaults to ValueAndUnit.UNITMODE_PIXEL

    • Optional negativeValueAllowed: boolean

      defines a boolean indicating if the value can be negative

    Returns ValueAndUnit

Properties

ignoreAdaptiveScaling: boolean

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

see

https://doc.babylonjs.com/how_to/gui#adaptive-scaling

negativeValueAllowed: boolean

defines a boolean indicating if the value can be negative

onChangedObservable: Observable<void>

BABYLON.Observable event triggered each time the value or unit changes

Accessors

  • get internalValue(): number
  • Gets value (without units)

    deprecated

    use value property instead

    Returns number

  • get isPercentage(): boolean
  • Gets a boolean indicating if the value is a percentage

    Returns boolean

  • get isPixel(): boolean
  • Gets a boolean indicating if the value is store as pixel

    Returns boolean

  • get unit(): number
  • set unit(value: number): void
  • Gets units (without value)

    Returns number

  • Sets units (without value)

    Parameters

    • value: number

    Returns void

  • get value(): number
  • set value(value: number): void
  • Gets value (without units)

    Returns number

  • Sets value (without units)

    Parameters

    • value: number

    Returns void

  • get UNITMODE_PERCENTAGE(): number
  • UNITMODE_PERCENTAGE

    Returns number

  • get UNITMODE_PIXEL(): number
  • UNITMODE_PIXEL

    Returns number

Methods

  • fromString(source: string | number): boolean
  • 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

    Returns number

    the value

  • Gets value as pixel

    Parameters

    • host: AdvancedDynamicTexture

      defines the root host

    • refValue: number

      defines the reference value for percentages

    Returns number

    the value as pixel

  • Gets a string representation of the value

    Parameters

    • host: AdvancedDynamicTexture

      defines the root host

    • Optional decimals: number

      defines an optional number of decimals to display

    Returns string

    a string

  • Update the current value and unit.

    Parameters

    • value: number

      defines the value to store

    • Optional unit: number

      defines the unit to store

    Returns ValueAndUnit

    the current ValueAndUnit

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited constructor
  • Static method

Settings

Theme