Class: Picker
Class: Picker
A Tool for manual user picking points on faces and vertices and finding their coordinates and normal.
Constructors
constructor
• new Picker(renderManager
): Picker
Parameters
Name | Type | Description |
---|---|---|
renderManager | RenderManagerBase | RenderManagerBase instance. |
Returns
Properties
additionalObjects
• additionalObjects: Set
<Mesh
<BufferGeometry
<NormalBufferAttributes
>, Material
| Material
[], Object3DEventMap
> | InstancedMesh
<BufferGeometry
<NormalBufferAttributes
>, Material
| Material
[], InstancedMeshEventMap
> | Line
<BufferGeometry
<NormalBufferAttributes
>, Material
| Material
[], Object3DEventMap
>>
Additional objects with picking capability.
hasIntersection
• hasIntersection: boolean
Is there a intersection with picking ray and vertex or face.
intersectionType
• intersectionType: PickerIntersectionType
The type of active intersection.
isBlockSelection
• isBlockSelection: boolean
Whether the selection of elements during picking is locked or not.
rayFaceNormal
• rayFaceNormal: Vector3
The normal of the face on which the rayPoint is located.
rayPoint
• rayPoint: Vector3
The point on vertex or face from the picking ray.
Methods
dispose
▸ dispose(): void
Destroy picker and release all events.
Returns
void
endPicking
▸ endPicking(isCanceled?
): boolean
End picking action.
Parameters
Name | Type | Description |
---|---|---|
isCanceled? | boolean | Action result. Will be passed to the callbacks. |
Returns
boolean
True if picking has been ended successfully.
onBeforeEnd
▸ onBeforeEnd(callback
): this
Add callback for end picking event. Callback stores only for one picking session called by startPicking.
Parameters
Name | Type | Description |
---|---|---|
callback | (isCanceled : boolean ) => boolean | void | Callback function. The callback must return true, false, or undefined. If the callback returns false, the "end picking" operation will be aborted and the picker will remain active. |
Returns
this
onEnd
▸ onEnd(callback
): this
Add callback for end picking event. Callback stores only for one picking session called by startPicking.
Parameters
Name | Type | Description |
---|---|---|
callback | (isCanceled : boolean ) => void | Callback function. |
Returns
this
onPick
▸ onPick(callback
): this
Add callback for 'pick' event. Callback stores only for one picking session called by startPicking. If callback returns false then 'end' event will chanceled.
Parameters
Name | Type | Description |
---|---|---|
callback | (intersectionType : PickerIntersectionType , rayPoint : Vector3 , rayFaceNormal : Vector3 ) => void | Callback function. |
Returns
this
setMessage
▸ setMessage(message
): this
Set optional message for user during the picking process. The message is active only for one picking session called by startPicking.
Parameters
Name | Type | Description |
---|---|---|
message | string | Hint message. |
Returns
this
startPicking
▸ startPicking(blockSelection?
, stopAtClick?
, snapToPoints?
, snapToLines?
): Picker
Starts picking action.
Parameters
Name | Type | Description |
---|---|---|
blockSelection? | boolean | Block selection of elements during picking or not. |
stopAtClick? | boolean | Stop picking after the first click or continue onward. |
snapToPoints? | boolean | Snap to vertices or on faces. |
snapToLines? | boolean | Snap to vertices on lines. |
Returns
Picker instance if picking started successfully or undefined if not.