scene.interaction
Pointer hits, clicks, hover state, and dragging.
6 functions / 8 types
Index
| Function | Description |
|---|---|
| clicks | Report the clicks on the viewport since the last time this action was called. |
| getInteractable | Get whether a scene object is currently interactable. |
| hovers | Report the hovers on the viewport since the last time this action was called. |
| isDragging | Check if a scene object is being actively dragged |
| setDraggable | Set a scene object as draggable and poll for recent changes This will also make it interactible. |
| setInteractable | Set whether a scene object is interactable. |
| Type | Description |
|---|---|
| BlockModelHitData | Kind-specific data about hitting a block model |
| Click | One click on a scene node, as reported by Clicks. |
| Hit | One scene node under the cursor, as reported by Hovers. |
| HitData | Kind-specific data about hitting an object |
| MeshHitData | Kind-specific data about hitting a mesh |
| PointCloudHitData | Kind-specific data about hitting a point cloud |
| PolylineHitData | Kind-specific data about hitting a polyline |
| ShapeHitData | Kind-specific data about hitting a shape |
clicks
clicks(transactionId?: string): Promise<Array<SceneInteractionClick>>Report the clicks on the viewport since the last time this action was called.
Returns Promise<Array<SceneInteractionClick>>.
transactionId optional : string
getInteractable
getInteractable(args: { node: SceneNode }, transactionId?: string): Promise<boolean>Get whether a scene object is currently interactable.
Returns Promise<boolean>.
node : SceneNode
transactionId optional : string
hovers
hovers(transactionId?: string): Promise<Array<SceneInteractionHit>>Report the hovers on the viewport since the last time this action was called.
Returns Promise<Array<SceneInteractionHit>>.
transactionId optional : string
isDragging
isDragging(args: { node: SceneNode }, transactionId?: string): Promise<boolean>Check if a scene object is being actively dragged
Returns Promise<boolean>.
node : SceneNode
The NodeSchema of the shape to make draggable.
transactionId optional : string
setDraggable
setDraggable(args: { dragKind?: SceneDragKind; node: SceneNode }, transactionId?: string): Promise<void>Set a scene object as draggable and poll for recent changes This will also make it interactible.
Returns Promise<void>.
dragKind optional : SceneDragKind
How the drag moves the shape. Absent leaves it dragging in the plane facing the camera.
node : SceneNode
The NodeSchema of the shape to make draggable.
transactionId optional : string
setInteractable
setInteractable(args: { interactible?: boolean; node: SceneNode }, transactionId?: string): Promise<void>Set whether a scene object is interactable.
Returns Promise<void>.
interactible optional : boolean
If unset, this will default to true.
node : SceneNode
transactionId optional : string
BlockModelHitData
Kind-specific data about hitting a block model
leaf : SceneLeafDescription
The element to pass to the component’s inspect_leaf query.
Click
One click on a scene node, as reported by Clicks.
hit : SceneInteractionHit
The underlying hit.
mouseButton : number
Which mouse button: 0 primary, 1 secondary, 2 middle.
Hit
One scene node under the cursor, as reported by Hovers.
info : SceneInteractionHitData
Additional data specific to the kind of scene object hit
node : SceneNode
The scene node under the cursor.
position : MathVec3
World position of the point under the cursor.
HitData
type SceneInteractionHitData = { kind: "blockModel"; value: SceneInteractionBlockModelHitData } | { kind: "pointCloud"; value: SceneInteractionPointCloudHitData } | { kind: "mesh"; value: SceneInteractionMeshHitData } | { kind: "polyline"; value: SceneInteractionPolylineHitData } | { kind: "shape"; value: SceneInteractionShapeHitData }Kind-specific data about hitting an object
MeshHitData
Kind-specific data about hitting a mesh
PointCloudHitData
Kind-specific data about hitting a point cloud
leaf : SceneLeafDescription
The element to pass to the component’s inspect_leaf query.
PolylineHitData
Kind-specific data about hitting a polyline
ShapeHitData
Kind-specific data about hitting a shape