Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ValueAndUnit

Class used to specific a value and its associated unit

Hierarchy

  • ValueAndUnit

Index

Constructors

constructor

  • 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

ignoreAdaptiveScalingSearch playground for ignoreAdaptiveScaling

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

negativeValueAllowedSearch playground for negativeValueAllowed

negativeValueAllowed: boolean

defines a boolean indicating if the value can be negative

onChangedObservableSearch playground for onChangedObservable

onChangedObservable: Observable<void>

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

Accessors

internalValue

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

    deprecated

    use value property instead

    Returns number

isPercentage

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

    Returns boolean

isPixel

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

    Returns boolean

unit

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

    Returns number

  • Sets units (without value)

    Parameters

    • value: number

    Returns any

value

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

    Returns number

  • Sets value (without units)

    Parameters

    • value: number

    Returns any

Static UNITMODE_PERCENTAGE

  • get UNITMODE_PERCENTAGE(): number
  • UNITMODE_PERCENTAGE

    Returns number

Static UNITMODE_PIXEL

  • get UNITMODE_PIXEL(): number
  • UNITMODE_PIXEL

    Returns number

Methods

fromStringSearch playground for fromString

  • 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

getValueSearch playground for getValue

  • Gets the value accordingly to its unit

    Parameters

    Returns number

    the value

getValueInPixelSearch playground for getValueInPixel

  • 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

toStringSearch playground for toString

  • 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

updateInPlaceSearch playground for updateInPlace

  • 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 property
  • Inherited method
  • Static property
  • Static method