An object selection.

Object selections use render layers to facilitate quick and efficient visibility changes.

Hierarchy

  • Set<Object3D>
    • Selection

Constructors

  • Constructs a new selection.

    Parameters

    • Optionaliterable: Iterable<Object3D<Object3DEventMap>>

      A collection of objects that should be added to this selection.

    • Optionallayer: number

      A dedicated render layer for selected objects.

    Returns Selection

Properties

[toStringTag]: string
exclusive: boolean

Controls whether objects that are added to this selection should be removed from all other layers.

size: number

the number of (unique) elements in Set.

[species]: SetConstructor

Accessors

  • get layer(): number
  • The render layer for selected objects.

    Returns number

  • set layer(arg): void
  • Parameters

    • arg: number

    Returns void

Methods

  • Iterates over values in the set.

    Returns IterableIterator<Object3D<Object3DEventMap>>

  • Adds an object to this selection.

    If exclusive is set to true, the object will also be removed from all other layers.

    Parameters

    • object: Object3D<Object3DEventMap>

      The object that should be selected.

    Returns this

    This selection.

  • Clears this selection.

    Returns this

    This selection.

  • Removes a specified value from the Set.

    Parameters

    • value: Object3D<Object3DEventMap>

    Returns boolean

    Returns true if an element in the Set existed and has been removed, or false if the element does not exist.

  • Returns an iterable of [v,v] pairs for every value v in the set.

    Returns IterableIterator<[Object3D<Object3DEventMap>, Object3D<Object3DEventMap>]>

  • Executes a provided function once per each value in the Set object, in insertion order.

    Parameters

    • callbackfn: ((value: Object3D<Object3DEventMap>, value2: Object3D<Object3DEventMap>, set: Set<Object3D<Object3DEventMap>>) => void)
        • (value, value2, set): void
        • Parameters

          • value: Object3D<Object3DEventMap>
          • value2: Object3D<Object3DEventMap>
          • set: Set<Object3D<Object3DEventMap>>

          Returns void

    • OptionalthisArg: any

    Returns void

  • Returns the current render layer for selected objects.

    The default layer is 10. If this collides with your own custom layers, please change it before rendering!

    Returns number

    The layer.

    Use layer instead.

  • Parameters

    • value: Object3D<Object3DEventMap>

    Returns boolean

    a boolean indicating whether an element with the specified value exists in the Set or not.

  • An alias for has.

    Parameters

    • object: Object3D<Object3DEventMap>

      An object.

    Returns number

    Returns 0 if the given object is currently selected, or -1 otherwise.

    Added for backward-compatibility.

  • Indicates whether objects that are added to this selection will be removed from all other layers.

    Returns number

    Whether this selection is exclusive. Default is false.

    Use exclusive instead.

  • Despite its name, returns an iterable of the values in the set.

    Returns IterableIterator<Object3D<Object3DEventMap>>

  • Clears this selection and adds the given objects.

    Parameters

    • objects: Iterable<Object3D<Object3DEventMap>>

      The objects that should be selected.

    Returns this

    This selection.

  • Controls whether objects that are added to this selection should be removed from all other layers.

    Parameters

    • value: number

      Whether this selection should be exclusive.

    Returns void

    Use exclusive instead.

  • Sets the render layer for selected objects.

    The current selection will be updated accordingly.

    Parameters

    • value: number

      The layer. Range is [0, 31].

    Returns void

    Use layer instead.

  • Sets the visibility of all selected objects.

    This method enables or disables render layer 0 of all selected objects.

    Parameters

    • visible: boolean

      Whether the selected objects should be visible.

    Returns this

    This selection.

  • Removes an existing object from the selection. If the object doesn't exist it's added instead.

    Parameters

    • object: Object3D<Object3DEventMap>

      The object.

    Returns boolean

    Returns true if the object is added, false otherwise.

  • Returns an iterable of values in the set.

    Returns IterableIterator<Object3D<Object3DEventMap>>