Class ViewersGrid

The ViewersGrid class displays a grid of molecule or a crystal viewers in 3D using MoleculeViewer widgets for rendering.

Hierarchy

  • ViewersGrid

Constructors

Properties

activeChanged: ((guid: GUID, indexes: Indexes) => void)

Type declaration

    • (guid: GUID, indexes: Indexes): void
    • Callback fired when the active viewer is changed

      Parameters

      • guid: GUID

        GUID of the new active viewer

      • indexes: Indexes

        environment showed in the new active viewer

      Returns void

delayChanged: ((delay: number) => void)

Type declaration

    • (delay: number): void
    • Callback fired when the playback delay for structure/atom playback changed

      Parameters

      • delay: number

        the new delay value

      Returns void

loadStructure: ((index: number, structure: unknown) => Structure)

Type declaration

    • (index: number, structure: unknown): Structure
    • Callback used when a new structure should be loaded

      By default, this assumes that the loaded dataset contains Structure directly, and returns the data from there. If the loaded dataset contains UserStructure instead, this callback should be set to transform from data in data to a Structure.

      The callback gets two parameter: the structure index (0-based); and the full UserStructure.

      Parameters

      • index: number
      • structure: unknown

      Returns Structure

oncreate: ((guid: GUID, color: string, indexes: Indexes) => void)

Type declaration

    • (guid: GUID, color: string, indexes: Indexes): void
    • Callback fired when a new viewer is created

      Parameters

      • guid: GUID

        GUID of the new viewer

      • color: string

        GUID of the marker indicating the new viewer

      • indexes: Indexes

        environment showed in the new viewer

      Returns void

onremove: ((guid: GUID) => void)

Type declaration

    • (guid: GUID): void
    • Callback fired when a viewer is removed from the grid

      Parameters

      Returns void

onselect: ((indexes: Indexes) => void)

Type declaration

    • (indexes: Indexes): void
    • Callback used when the user select an environment

      Parameters

      Returns void

Accessors

  • set positionSettingsModal(value: PositioningCallback): void
  • Set a callback to get the initial positioning of the settings modal of the viewers. The same callback is used for all viewers in the grid.

    The callback gets the current placement of the settings as a DOMRect, and should return top and left positions in pixels, used with position: fixed. The callback is called once, the first time the settings are opened.

    Parameters

    Returns void

Methods

  • Add a new empty viewer to the grid

    Returns

    the GUID and color of the new viewer, the GUID is undefined if we already reached the viewer limit.

    Returns { color: string; guid?: GUID }

    • color: string
    • Optional guid?: GUID
  • Apply the given saved setting to all viewers in the grid.

    The settings must be in viewer creation order.

    Parameters

    • settings: Settings[]

      settings for all viewers in the grid

    Returns void

  • Add the given callback to be called whenever a setting changes. The callback will be given the path to the settings as a list of keys; and the new value of the setting.

    There is currently no way to remove a callback.

    Parameters

    • callback: ((keys: string[], value: unknown) => void)
        • (keys: string[], value: unknown): void
        • Parameters

          • keys: string[]
          • value: unknown

          Returns void

    Returns void

  • Removes the viewer with the given guid from the viewer grid.

    Parameters

    • guid: GUID

      GUID of the viewer to remove

    Returns void

  • Get the current values of settings for all viewers in the grid.

    The settings are given in viewer creation order.

    Returns

    the settings in an array, suitable to be used with applySettings

    Returns Settings[]

  • Function to set the active widget for communicating with the map

    Parameters

    Returns void

  • Show a new structure, as identified by indexes in the active viewer.

    This will switch to the structure at index indexes.structure, and if environments where passed to the constructor and the current display mode is 'atom', highlight the atom-centered environment corresponding to indexes.atom.

    Parameters

    • indexes: Indexes

      structure / atom pair to display

    Returns void