SelectionExtension
Defalt selection helper extension. Handles object selection automatically, both visually and data wise. Optionally can highlight on hover.
The extension automatically binds to:
ViewerEvent.ObjectClicked
for selection detection.ViewerEvent.ObjectDoubleClicked
for focusing on objectsInputEvent.PointerMove
for hover detection
This extension requires and active CameraController extension implementation.
Note that this extension will automatically remember the last material for each material that you select and automatically apply it upon deselection. This might affect the end result if you are combining selection with other operations like isolating, hiding or coloring.
Accessors
enabled
Enables/disables the extension.
Returns: boolean
options
Gets and sets the extension options.
Returns: SelectionExtensionOptions
Methods
getSelectedObjects
Gets the currently selected raw objects.
Returns: Array< Record< string, unknown > >
getSelectedNodes
Gets the currently selected nodes.
Returns: Array< TreeNode >
selectObjects
Programatically selects objects by ids.
Parameters
- ids: Array< string >
- optional multiSelect: Signals if this select needs to clear previous one or not
Returns: void
unselectObjects
Programatically un-selects objects by ids.
Parameters
- optional ids: Array< string >. If not specified everything gets unselected
Returns: void
Typedefs
SelectionExtensionOptions
Options for configuring how the visual selection looks. If hoverMaterialData
is not specified, there will be no hover effect.
The selection/hover material data is provided as an intersection between a RenderMaterial, a DisplayStyle and a MaterialOptions in order to accomodate all renderable types: triangles, lines and points.
- selectionMaterialData: The material data for selection effect
- hoverMaterialData: The material data for hover effect. If not specified, hover will not be enabled