Editor API Reference - v1.1.4
    Preparing search index...

    Class Selection

    Selection API. Allows selecting Entities, Assets etc.

    Hierarchy

    • Events
      • Selection
    Index

    Internal

    Other

    • get enabled(): boolean

      Gets enabled state of the selection methods.

      Returns boolean

    • set enabled(value: boolean): void

      Sets enabled state of the selection methods.

      Parameters

      • value: boolean

      Returns void

    • get items(): (Entity | Asset)[]

      Gets the selected items. This creates a new array every time it is called.

      Returns (Entity | Asset)[]

      editor.selection.items.add(editor.entities.root);
      const selectedEntities = editor.selection.items;
    • Add item to selection

      Parameters

      • item: any
      • options: { history?: boolean } = {}

      Returns void

      // add root entity to selection
      editor.selection.add(editor.entities.root);
    • Clears selection

      Parameters

      • options: { history?: boolean } = {}

      Returns void

      editor.selection.clear();
      
    • Checks if item is in selection

      Parameters

      • item: any

      Returns boolean

      const isRootSelected = editor.selection.has(editor.entities.root);
      
    • Remove item from selection

      Parameters

      • item: any
      • options: { history?: boolean } = {}

      Returns void

      // remove root entity from selection
      editor.selection.remove(editor.entities.root);
    • Sets current selection

      Parameters

      • items: any[]
      • options: { history?: boolean } = {}

      Returns void

      // select root entity
      editor.selection.set([editor.entities.root]);
    • Toggle item selection

      Parameters

      • item: any
      • options: { history?: boolean } = {}

      Returns void

      // toggle root entity selection
      editor.selection.toggle(editor.entities.root);