Class UIOption

The UIOption controls UI element layout options, possibly by overriding the default options specified in UI element style.

The class follows the 'copy-on-write' pattern, which means that every operation returns a copy of the UIOption with updates values. It also implies that the values of the UIOption cannot be directly modified.

The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

Constructors

  • Parameters

    • Optionalstate: boolean
    • Optionalmin: number
    • Optionalmax: number
    • Optionaltype: EnumValue<UIOptionType, number>

    Returns UIOption

Properties

_max: number
_min: number
_state: boolean
_type: EnumValue<UIOptionType, number>

Accessors

  • get max(): number
  • Returns number

  • set max(value): void
  • Parameters

    • value: number

    Returns void

  • get min(): number
  • Returns number

  • set min(value): void
  • Parameters

    • value: number

    Returns void

  • get state(): boolean
  • Returns boolean

  • set state(value): void
  • Parameters

    • value: boolean

    Returns void

Methods

  • Copies all properties defined by the prototype of UIOption from other to this instance.

    Parameters

    Returns UIOption

  • Clones this instance and returns a new UIOption with identical values.

    Returns UIOption

  • Determines if this UIOption instance is equal to the other instance.

    Parameters

    Returns boolean

  • Constructs a UI option notifying the UI layout that this element has a fixed height. This will override the height property set in element style.

    Parameters

    • height: number

      Height in pixels.

    • Optionalscalable: boolean

      If true, will enable the scaling. If false, will disable.

    Returns UIOption

    New option object that can be used for initializing a UI element.

  • Constructs a UI option notifying the UI layout that this element has a fixed width. This will override the width property set in element style.

    Parameters

    • width: number

      Width in pixels.

    • Optionalscalable: boolean

      If true, will enable the scaling. If false, will disable.

    Returns UIOption

    New option object that can be used for initializing a UI element.

  • Constructs a UI option notifying the UI layout that this element has a flexible height with optional min/max constraints. Element will be resized according to its contents and parent layout but will always stay within the provided range.

    Parameters

    • OptionalminHeight: number

      Minimum height in pixels. Element will never be smaller than this height.

    • OptionalmaxHeight: number

      Maximum height in pixels. Element will never be larger than this height. Specify zero for unlimited height.

    • Optionalexpandable: boolean

      If set to true, the element will expand and take all the available space, similar to a Flexible Space element. By default set to false, which disable the expansion behavior.

    Returns UIOption

    New option object that can be used for initializing a UI element.

  • Constructs a UI option notifying the UI layout that this element has a flexible width with optional min/max constraints. Element will be resized according to its contents and parent layout but will always stay within the provided range.

    Parameters

    • OptionalminWidth: number

      Minimum width in pixels. Element will never be smaller than this width.

    • OptionalmaxWidth: number

      Maximum width in pixels. Element will never be larger than this width. Specify zero for unlimited width.

    • Optionalexpandable: boolean

      If set to true, the element will expand and take all the available space, similar to a Flexible Space element. By default set to false, which disable the expansion behavior.

    Returns UIOption

    New option object that can be used for initializing a UI element.

  • Constructs a UI option notifying the UI layout that this element should be positioned at this offset from the parent UI panel. This option is ignored if element is part of a layout since it controls its placement.

    Parameters

    • x: number

      Horizontal offset from the parent UI panel origin, in pixels.

    • y: number

      Vertical offset from the parent UI panel origin, in pixels.

    Returns UIOption

    New option object that can be used for initializing a UI element.

  • Constructs a UI option notifying the UI layout that this element should scale it's height with display DPI scale.

    Parameters

    • Optionalscalable: boolean

      If true, will enable the scaling. If false, will disable.

    Returns UIOption

    New option object that can be used for initializing a UI element.

  • Constructs a UI option notifying the UI layout that this element should scale it's width with display DPI scale.

    Parameters

    • Optionalscalable: boolean

      If true, will enable the scaling. If false, will disable.

    Returns UIOption

    New option object that can be used for initializing a UI element.