Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LayoutEditor

The Layout Editor allows modifying Layouts while ensuring all the different invariants of the Layout objects are upheld no matter what kind of operations are being applied. It provides the current state of the editor as state objects that can be visualized by any kind of User Interface.

Hierarchy

Index

Constructors

constructor

Properties

ptr

ptr: number

Methods

addComponent

  • Adds the component provided to the end of the layout. The newly added component becomes the selected component.

    Parameters

    Returns void

close

  • Closes the Layout Editor and gives back access to the modified Layout. In case you want to implement a Cancel Button, just dispose the Layout object you get here.

    Returns Layout

dispose

  • dispose(): void
  • Disposes the object, allowing it to clean up all of its memory. You need to call this for every object that you don't use anymore and hasn't already been disposed.

    Returns void

duplicateComponent

  • duplicateComponent(): void
  • Duplicates the currently selected component. The copy gets placed right after the selected component and becomes the newly selected component.

    Returns void

layoutStateAsJson

  • Encodes the layout's state as JSON based on the timer provided. You can use this to visualize all of the components of a layout, while it is still being edited by the Layout Editor.

    Parameters

    Returns any

moveComponent

  • moveComponent(dstIndex: number): void
  • Moves the selected component to the index provided. You may not provide an invalid index.

    Parameters

    • dstIndex: number

    Returns void

moveComponentDown

  • moveComponentDown(): void

moveComponentUp

  • moveComponentUp(): void
  • Moves the selected component up, unless the first component is selected.

    Returns void

removeComponent

  • removeComponent(): void
  • Removes the currently selected component, unless there's only one component in the layout. The next component becomes the selected component. If there's none, the previous component becomes the selected component instead.

    Returns void

select

  • select(index: number): void
  • Selects the component with the given index in order to modify its settings. Only a single component is selected at any given time. You may not provide an invalid index.

    Parameters

    • index: number

    Returns void

setComponentSettingsValue

  • setComponentSettingsValue(index: number, value: SettingValue): void
  • Sets a setting's value of the selected component by its setting index to the given value.

    This panics if the type of the value to be set is not compatible with the type of the setting's value. A panic can also occur if the index of the setting provided is out of bounds.

    Parameters

    Returns void

setGeneralSettingsValue

  • setGeneralSettingsValue(index: number, value: SettingValue): void
  • Sets a setting's value of the general settings by its setting index to the given value.

    This panics if the type of the value to be set is not compatible with the type of the setting's value. A panic can also occur if the index of the setting provided is out of bounds.

    Parameters

    Returns void

state

stateAsJson

  • stateAsJson(): any
  • Encodes the Layout Editor's state as JSON in order to visualize it.

    Returns any

updateLayoutState

updateLayoutStateAsJson

with

  • Allows for scoped usage of the object. The object is guaranteed to get disposed once this function returns. You are free to dispose the object early yourself anywhere within the scope. The scope's return value gets carried to the outside of this function.

    Type parameters

    • T

    Parameters

    Returns T

Static new

  • Creates a new Layout Editor that modifies the Layout provided. Creation of the Layout Editor fails when a Layout with no components is provided. In that case null is returned instead.

    Parameters

    Returns LayoutEditor

Generated using TypeDoc