Home > @modelo.io/api > SelectElements

SelectElements class

Select one or more elements by mouse clicking.

Signature:

export default class SelectElement extends Tool 

Constructors

ConstructorDescription
(constructor)(viewer)Create the tool.

Methods

MethodDescription
addInput(input)Add input to the selectElement tool
pick(elementNames, changeCamera)Pick elements by specifying their names.
setCloseUpEnabled(enabled)Enable/Disable moving camera to a close up view after elements selected.
setEnabled(enabled)Enable the tool.
setHighlightEnabled(enabled)If the elements will be highlighted when selected.
setLineColor(lineColor)Set the elements' lines color when elements are picked.
setMultiselectEnabled(enabled)Enable/Disable multiSelect
setRegionSelectEnabled(enabled)Enable/Disable region select.
setSelectionRectangleColor(color)Change the color of selection rectangluar gizmo color and transparency.

Example

var selectElement = new Modelo.View.Tool.SelectElement(viewer);
viewer.addTool(selectElement);

viewer.getEventEmitter().on("onElementSelected", elementNames1 => {
   if (elementNames1.length === 0) {
       console.log("none is selected");
   } else {
       console.log(elementNames1.join(","));
   }
viewer.getEventEmitter().on("onPointPicked", point => {
   console.log(point);
})
});