Class: SelectionMap

PD. SelectionMap

Stores a map of items and any of their sub-times that are also selected.

Selection sets only store one type of selection, so you cannot add an aperture to a set that already contains junctions, and visa versa. You can check this using the readonly type property. This value is set by the add...() and select...() methods, and cleared by the clear() method.

Selection data for associating sub-items with each main item is a simple object with an array property. The array contains references to each selected sub-item that belongs to the main item.

The reason this is stored as an object rather than just an array is that it allows the undo/redo and other systems to store additional data for each selected element. Literally every action carried out on a multiple selection set creates a copy of that selection set and stores additional data on it, so this is frequent and convenient enough to more than warrant the small extra overhead involved.


new SelectionMap()

Creates a new selection set instance.

Author:
  • drajmarsh

Extends

  • Map

Members


:boolean

isSelectionMap <readonly>

A flag identifying this object as a selection set.

Type
  • boolean

:PD.SELECTED

type <readonly>

Stores the type of the currently stored selection data.

Type

Methods


clear( [type])

Clears and empties the selection set.

Parameters:
Name Type Argument Description
type PD.SELECTED <optional>

An optional type to set once cleared, defaults to PD.SELECTED.NONE.

Returns:

Returns this instance to support method chaining.

Type
PD.SelectionSet

clone()

Creates a shallow copy of the selection set.

This is primarily used by the undo/redo system to keep a copy of the actioned selection set. The arrays stored in the associated data objects are not reused when the selection changes or is cleared, so it is safe for them to nbe stored directly in undo/redo steps.

Returns:

Returns a new selection set.

Type
PD.SelectionSet

setType(type)

Sets the type of the currently stored selection data.

If the new type is different from the previous type, the existing selection set will be cleared.

Parameters:
Name Type Description
type PD.SELECTED

The new type to set.

Returns:

Returns this instance to support method chaining.

Type
PD.SelectionSet