GIScene.Control.Select Class
Control to enable the interactive selection and or highlighting of 3D Objects in the scene
Constructor
GIScene.Control.Select
-
selectables
-
camera
-
[config]
Parameters:
-
selectables
Array | THREE.Object3DAn Array or single THREE.Object3D. Contains the potentially selectable Elements of type THREE.Object3D
-
camera
THREE.CameraThe active camera
-
[config]
Object optionalConfiguration properties to influence the behaviour of this Control
You can use multiple options to customize the behaviour of the Select Control:
Main options: 1. Choose between hover or click behaviour by setting hover:true || hover:false
- Choose whether objects should be really selected or just highlighted by setting highlightOnly:true || highlightOnly:false
- Choose a highlighting color by setting e.g: selectColor:0xff0000
The following options are only available if hover:false:
multi - whether it is possible to select only one object or multiple (hold down CTRL-Key)
toggle - whether click on a selected/highlighted object unselects/unhighlights it again
clickout - whether a click somewhere not on a selectable object unselects all others
You can even combine 2 Select controls to enable highlighting on mouseover ('hover') and selection on click:
Example:
var selectControl = new GIScene.Control.Select(scene.root.children, scene.camera, {highlightOnly:false, hover:false, multi:false, toggle:true, clickout:true});
scene.addControl(selectControl);
selectControl.activate();
var highlightControl = new GIScene.Control.Select(scene.root.children, scene.camera, {highlightOnly:true, hover:true});
scene.addControl(highlightControl);
highlightControl.activate();
Item Index
Methods
activate
()
Activates this Control
deactivate
()
Deactivates this Control
highlight
-
object
-
interaction
Highlight an object. This will also be called by the select() function. Sets object.userData.isHighlighted = true.
Parameters:
-
object
THREE.Object3D -
interaction
Booleanthis flag is used to differentiate between user interaction triggered selection or programmatical selection resulting in a special event for user-triggerd selections.
removeSelectable
-
object
Removes an object from the selectables Array
Parameters:
-
object
THREE.Object3D
select
-
object
-
interaction
Select an object. This will also call the highlight() function. Sets object.userData.isSelected = true.
Parameters:
-
object
THREE.Object3D -
interaction
Booleanthis flag is used to differentiate between user interaction triggered selection or programmatical selection resulting in a special event for user-triggerd selections.
setScene
-
scene
Parameters:
-
scene
Object
unhighlight
-
object
-
interaction
Unhighlight an object. This will also be called by the unselect() function. Sets object.userData.isHighlighted = false.
Parameters:
-
object
THREE.Object3D -
interaction
Booleanthis flag is used to differentiate between user interaction triggered selection or programmatical selection resulting in a special event for user-triggerd selections.
unselect
-
object
-
interaction
Unselect an object. This will also call the unhighlight() function. Sets object.userData.isSelected = false.
Parameters:
-
object
THREE.Object3D -
interaction
Booleanthis flag is used to differentiate between user interaction triggered selection or programmatical selection resulting in a special event for user-triggerd selections.
Properties
config
Object
The config which is used to initialize the Control. Merged from defaults and passed config Object.
isActive
Boolean
Events
highlighted
The highlighted event will be triggered after the feature is highlighted. The event contains a content property with a reference to the highlighted object.
highlightedbyuser
The highlightedbyuser event will be triggered after the feature is highlighted by a user interaction. The event contains a content property with a reference to the highlighted object.
selected
The selected event will be triggered before the feature is highlighted. The event contains a content property with a reference to the selected object.
selectedbyuser
The selectedbyuser event will be triggered before the feature is highlighted. The event contains a content property with a reference to the selected object.
unhighlightall
unhighlightallbyuser
unhighlighted
The unhighlighted event will be triggered after the feature is unhighlighted. The event contains a content property with a reference to the unhighlighted object.
unhighlightedbyuser
The unhighlightedbyuser event will be triggered after the feature is unhighlighted through user interaction. The event contains a content property with a reference to the unhighlighted object.
unselectall
unselectallbyuser
unselected
The unselected event will be triggered after the feature is unhighlighted. The event contains a content property with a reference to the unselected object.
unselectedbyuser
The unselectedbyuser event will be triggered after the feature is unhighlighted. The event contains a content property with a reference to the unselected object.