editor › Globals › InteractionManager
Class: InteractionManager
This class handles input events and delegates them to InteractionHandler instances.
Hierarchy
- InteractionManager
Index
Constructors
Properties
- compositeModel
- deviceInputContinueEventEmitter
- deviceInputEndEventEmitter
- deviceInputStartEventEmitter
- editor
- finishPromise
- finishedInteractionHandlers
- inputDevices
- interactionHandlers
- multipleInteractionsHandler
- previousMultipleInteractionsHandler
- renderConfigs
- renderContext
- renderContextDirty
- requestModelResetEventEmitter
- toolErrorEventEmitter
- toolLibrary
- toolSelectedEventEmitter
- toolUsageFinishEventEmitter
- toolUsageStartEventEmitter
- toolUserMessageEventEmitter
- toolUserProgressCancelEventEmitter
- toolUserProgressEventEmitter
- toolUserProgressFinishEventEmitter
- wakeUpRendererOnEveryInteraction
Methods
- _afterInputHandled
- _applyRenderConfigs
- _beforeInputHandled
- _bindCompositeModelListeners
- _bindInteractionHandlerListeners
- _clearAllInteractions
- _clearInteraction
- _flushBoxelQueueIfNecessary
- _getInteractableObjects
- _getInteractionHandler
- _onInput
- _onInputContinue
- _onInputEnd
- _onInputStart
- _onInteractionCanceled
- _onToolMappingChange
- _onToolSelected
- _onToolUsageFinish
- _onToolUsageStart
- _onToolUserDeselected
- _showHints
- _unbindCompositeModelListeners
- _unbindInteractionHandlerListeners
- addInputDevice
- cancelAllInteractions
- cancelMultiInteractionTool
- getDeviceInputContinueEventEmitter
- getDeviceInputEndEventEmitter
- getDeviceInputStartEventEmitter
- getRequestModelResetEventEmitter
- getToolErrorEventEmitter
- getToolSelectedEventEmitter
- getToolUsageFinishEventEmitter
- getToolUsageStartEventEmitter
- getToolUserMessageEventEmitter
- getToolUserProgressCancelEventEmitter
- getToolUserProgressEventEmitter
- getToolUserProgressFinishEventEmitter
- markRenderContextDirty
- removeInputDevice
- setCompositeModel
- setToolLibrary
- whenAllToolInteractionFinished
Constructors
constructor
+ new InteractionManager(editor: Editor, renderContext: RenderContext): InteractionManager
Defined in src/input/InteractionManager.ts:111
Parameters:
| Name | Type |
|---|---|
editor |
Editor |
renderContext |
RenderContext |
Returns: InteractionManager
Properties
Private compositeModel
• compositeModel: CompositeModel
Defined in src/input/InteractionManager.ts:47
Private Readonly deviceInputContinueEventEmitter
• deviceInputContinueEventEmitter: EventEmitter‹IInputEvent› = new EventEmitter
Defined in src/input/InteractionManager.ts:90
Private Readonly deviceInputEndEventEmitter
• deviceInputEndEventEmitter: EventEmitter‹IInputEvent› = new EventEmitter
Defined in src/input/InteractionManager.ts:91
Private Readonly deviceInputStartEventEmitter
• deviceInputStartEventEmitter: EventEmitter‹IInputEvent› = new EventEmitter
Defined in src/input/InteractionManager.ts:89
Private Readonly editor
• editor: Editor
Defined in src/input/InteractionManager.ts:34
Private finishPromise
• finishPromise: Promise‹void› = Promise.resolve()
Defined in src/input/InteractionManager.ts:111
A promise that resolves when all tool interactions finished
Private finishedInteractionHandlers
• finishedInteractionHandlers: ExpiringSet‹InteractionHandler‹›› = new ExpiringSet
Defined in src/input/InteractionManager.ts:98
Finished interaction handlers, that might lead to consecutive clicks. Old entries will be cleared occasionally.
Private inputDevices
• inputDevices: any[] = []
Defined in src/input/InteractionManager.ts:40
List of all active input devices
Private interactionHandlers
• interactionHandlers: Map‹string, InteractionHandler‹›› = new Map
Defined in src/input/InteractionManager.ts:53
All currently active interactionHandlers indexed by the inputEventId that they handle.
Private multipleInteractionsHandler
• multipleInteractionsHandler: InteractionHandler = null
Defined in src/input/InteractionManager.ts:58
The most recent InteractionHandler that might be eligible to belong to the next click.
Private previousMultipleInteractionsHandler
• previousMultipleInteractionsHandler: InteractionHandler
Defined in src/input/InteractionManager.ts:63
The last InteractionHandler that was able to handle multiple clicks and might be needed again, when move operations are done
Private renderConfigs
• renderConfigs: Map‹InteractionHandler‹›, IRenderConfig› = new Map
Defined in src/input/InteractionManager.ts:106
Private Readonly renderContext
• renderContext: RenderContext
Defined in src/input/InteractionManager.ts:35
Private renderContextDirty
• renderContextDirty: boolean = false
Defined in src/input/InteractionManager.ts:45
Flag for keeping track of outdated render context data, is set after a tool interaction and cleared on render
Private Readonly requestModelResetEventEmitter
• requestModelResetEventEmitter: EventEmitter‹void› = new EventEmitter
Defined in src/input/InteractionManager.ts:92
Private Readonly toolErrorEventEmitter
• toolErrorEventEmitter: EventEmitter‹Error› = new EventEmitter
Defined in src/input/InteractionManager.ts:78
Private toolLibrary
• toolLibrary: ToolLibrary | null = null
Defined in src/input/InteractionManager.ts:48
Private Readonly toolSelectedEventEmitter
• toolSelectedEventEmitter: EventEmitter‹object› = new EventEmitter<{ toolManifestation: IToolManifestation }>()
Defined in src/input/InteractionManager.ts:69
Private Readonly toolUsageFinishEventEmitter
• toolUsageFinishEventEmitter: EventEmitter‹object› = new EventEmitter<{ consecutiveClick: boolean; parameters: any; toolManifestation: IToolManifestation; baseToolManifestation: any; baseParameters: any; isClick: boolean; }>()
Defined in src/input/InteractionManager.ts:70
Private Readonly toolUsageStartEventEmitter
• toolUsageStartEventEmitter: EventEmitter‹object› = new EventEmitter<{ parameters: any; toolManifestation: IToolManifestation; }>()
Defined in src/input/InteractionManager.ts:65
Private Readonly toolUserMessageEventEmitter
• toolUserMessageEventEmitter: EventEmitter‹object› = new EventEmitter<{ id: string | number }>()
Defined in src/input/InteractionManager.ts:79
Private Readonly toolUserProgressCancelEventEmitter
• toolUserProgressCancelEventEmitter: EventEmitter‹object› = new EventEmitter<{ id: string | number }>()
Defined in src/input/InteractionManager.ts:87
Private Readonly toolUserProgressEventEmitter
• toolUserProgressEventEmitter: EventEmitter‹object› = new EventEmitter<{ id: string | number; progress: number; message?: string; type?: string; cancelFunction?: () => void; }>()
Defined in src/input/InteractionManager.ts:80
Private Readonly toolUserProgressFinishEventEmitter
• toolUserProgressFinishEventEmitter: EventEmitter‹object› = new EventEmitter<{ id: string | number }>()
Defined in src/input/InteractionManager.ts:88
Private wakeUpRendererOnEveryInteraction
• wakeUpRendererOnEveryInteraction: any = Config.get("rendering.usePointerControls", false)
Defined in src/input/InteractionManager.ts:104
Always wake up the renderer even if no tool handles the input event This is necessary for the pointer controls to work correctly.
Methods
Private _afterInputHandled
▸ _afterInputHandled(): void
Defined in src/input/InteractionManager.ts:472
After an input event was handled, we remember that the render context is outdated and wake up the renderer.
Returns: void
Private _applyRenderConfigs
▸ _applyRenderConfigs(): void
Defined in src/input/InteractionManager.ts:582
Returns: void
Private _beforeInputHandled
▸ _beforeInputHandled(): Promise‹void›
Defined in src/input/InteractionManager.ts:462
Before we handle an input event, make sure that the scene is updated. This ensures, that the raycaster always sees the current model, even if no requestAnimationFrame was triggered since the last time the model was altered.
Returns: Promise‹void›
Private _bindCompositeModelListeners
▸ _bindCompositeModelListeners(compositeModel: any): void
Defined in src/input/InteractionManager.ts:477
Parameters:
| Name | Type |
|---|---|
compositeModel |
any |
Returns: void
Private _bindInteractionHandlerListeners
▸ _bindInteractionHandlerListeners(interactionHandler: InteractionHandler): void
Defined in src/input/InteractionManager.ts:501
Parameters:
| Name | Type |
|---|---|
interactionHandler |
InteractionHandler |
Returns: void
Private _clearAllInteractions
▸ _clearAllInteractions(): void
Defined in src/input/InteractionManager.ts:423
Returns: void
Private _clearInteraction
▸ _clearInteraction(interactionHandler: InteractionHandler, removeThreeNode: boolean): void
Defined in src/input/InteractionManager.ts:435
Clears the data of the given interactionHandler.
Parameters:
| Name | Type |
|---|---|
interactionHandler |
InteractionHandler |
removeThreeNode |
boolean |
Returns: void
Private _flushBoxelQueueIfNecessary
▸ _flushBoxelQueueIfNecessary(toolName: any): void
Defined in src/input/InteractionManager.ts:277
Parameters:
| Name | Type |
|---|---|
toolName |
any |
Returns: void
Private _getInteractableObjects
▸ _getInteractableObjects(): Object3D[]
Defined in src/input/InteractionManager.ts:555
Returns: Object3D[]
Private _getInteractionHandler
▸ _getInteractionHandler(inputEvent: IInputEvent): InteractionHandler‹›
Defined in src/input/InteractionManager.ts:343
Parameters:
| Name | Type | Description |
|---|---|---|
inputEvent |
IInputEvent | - |
Returns: InteractionHandler‹›
the InteractionHandler that should handle the inputEvent. This will usually be a new instance. But, if there is a multipleInteractionsTool currently active, it returns the associated InteractionHandler.
Private _onInput
▸ _onInput(inputEvent: IInputEvent): void
Defined in src/input/InteractionManager.ts:305
Parameters:
| Name | Type |
|---|---|
inputEvent |
IInputEvent |
Returns: void
Private _onInputContinue
▸ _onInputContinue(inputEvent: IInputEvent): boolean
Defined in src/input/InteractionManager.ts:390
Parameters:
| Name | Type | Description |
|---|---|---|
inputEvent |
IInputEvent | event coming from the input device |
Returns: boolean
Private _onInputEnd
▸ _onInputEnd(inputEvent: IInputEvent): boolean
Defined in src/input/InteractionManager.ts:402
Parameters:
| Name | Type |
|---|---|
inputEvent |
IInputEvent |
Returns: boolean
Private _onInputStart
▸ _onInputStart(inputEvent: IInputEvent): boolean
Defined in src/input/InteractionManager.ts:314
Parameters:
| Name | Type | Description |
|---|---|---|
inputEvent |
IInputEvent | event coming from the input device |
Returns: boolean
Private _onInteractionCanceled
▸ _onInteractionCanceled(interactionHandler: InteractionHandler): void
Defined in src/input/InteractionManager.ts:654
Parameters:
| Name | Type |
|---|---|
interactionHandler |
InteractionHandler |
Returns: void
Private _onToolMappingChange
▸ _onToolMappingChange(): void
Defined in src/input/InteractionManager.ts:414
Returns: void
Private _onToolSelected
▸ _onToolSelected(event: IToolSelectionEvent): void
Defined in src/input/InteractionManager.ts:252
Parameters:
| Name | Type |
|---|---|
event |
IToolSelectionEvent |
Returns: void
Private _onToolUsageFinish
▸ _onToolUsageFinish(__namedParameters: object): void
Defined in src/input/InteractionManager.ts:595
Parameters:
▪ __namedParameters: object
| Name | Type |
|---|---|
baseParameters |
any |
baseToolManifestation |
any |
consecutiveClick |
boolean |
finishPromise |
Promise‹boolean› |
interactionHandler |
InteractionHandler‹› |
parameters |
any |
uiManifestation |
any |
Returns: void
Private _onToolUsageStart
▸ _onToolUsageStart(__namedParameters: object): void
Defined in src/input/InteractionManager.ts:562
Parameters:
▪ __namedParameters: object
| Name | Type |
|---|---|
interactionHandler |
InteractionHandler‹› |
parameters |
any |
renderConfig |
IRenderConfig |
uiManifestation |
IToolManifestation |
Returns: void
Private _onToolUserDeselected
▸ _onToolUserDeselected(event: IToolSelectionEvent): void
Defined in src/input/InteractionManager.ts:549
Parameters:
| Name | Type |
|---|---|
event |
IToolSelectionEvent |
Returns: void
Private _showHints
▸ _showHints(toolName: string): void
Defined in src/input/InteractionManager.ts:284
Parameters:
| Name | Type |
|---|---|
toolName |
string |
Returns: void
Private _unbindCompositeModelListeners
▸ _unbindCompositeModelListeners(compositeModel: any): void
Defined in src/input/InteractionManager.ts:489
Parameters:
| Name | Type |
|---|---|
compositeModel |
any |
Returns: void
Private _unbindInteractionHandlerListeners
▸ _unbindInteractionHandlerListeners(interactionHandler: InteractionHandler): void
Defined in src/input/InteractionManager.ts:524
Parameters:
| Name | Type |
|---|---|
interactionHandler |
InteractionHandler |
Returns: void
addInputDevice
▸ addInputDevice(inputDevice: InputDevice): void
Defined in src/input/InteractionManager.ts:121
Parameters:
| Name | Type |
|---|---|
inputDevice |
InputDevice |
Returns: void
cancelAllInteractions
▸ cancelAllInteractions(): void
Defined in src/input/InteractionManager.ts:233
Returns: void
cancelMultiInteractionTool
▸ cancelMultiInteractionTool(): void
Defined in src/input/InteractionManager.ts:241
Returns: void
getDeviceInputContinueEventEmitter
▸ getDeviceInputContinueEventEmitter(): IPublicEventEmitterInterface‹IInputEvent›
Defined in src/input/InteractionManager.ts:221
Returns: IPublicEventEmitterInterface‹IInputEvent›
getDeviceInputEndEventEmitter
▸ getDeviceInputEndEventEmitter(): IPublicEventEmitterInterface‹IInputEvent›
Defined in src/input/InteractionManager.ts:225
Returns: IPublicEventEmitterInterface‹IInputEvent›
getDeviceInputStartEventEmitter
▸ getDeviceInputStartEventEmitter(): IPublicEventEmitterInterface‹IInputEvent›
Defined in src/input/InteractionManager.ts:217
Returns: IPublicEventEmitterInterface‹IInputEvent›
getRequestModelResetEventEmitter
▸ getRequestModelResetEventEmitter(): IPublicEventEmitterInterface‹void›
Defined in src/input/InteractionManager.ts:229
Returns: IPublicEventEmitterInterface‹void›
getToolErrorEventEmitter
▸ getToolErrorEventEmitter(): IPublicEventEmitterInterface‹Error›
Defined in src/input/InteractionManager.ts:197
Returns: IPublicEventEmitterInterface‹Error›
getToolSelectedEventEmitter
▸ getToolSelectedEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:189
Returns: IPublicEventEmitterInterface‹object›
getToolUsageFinishEventEmitter
▸ getToolUsageFinishEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:193
Returns: IPublicEventEmitterInterface‹object›
getToolUsageStartEventEmitter
▸ getToolUsageStartEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:185
Returns: IPublicEventEmitterInterface‹object›
getToolUserMessageEventEmitter
▸ getToolUserMessageEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:201
Returns: IPublicEventEmitterInterface‹object›
getToolUserProgressCancelEventEmitter
▸ getToolUserProgressCancelEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:209
Returns: IPublicEventEmitterInterface‹object›
getToolUserProgressEventEmitter
▸ getToolUserProgressEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:205
Returns: IPublicEventEmitterInterface‹object›
getToolUserProgressFinishEventEmitter
▸ getToolUserProgressFinishEventEmitter(): IPublicEventEmitterInterface‹object›
Defined in src/input/InteractionManager.ts:213
Returns: IPublicEventEmitterInterface‹object›
markRenderContextDirty
▸ markRenderContextDirty(): void
Defined in src/input/InteractionManager.ts:157
Returns: void
removeInputDevice
▸ removeInputDevice(inputDevice: any): void
Defined in src/input/InteractionManager.ts:133
Parameters:
| Name | Type |
|---|---|
inputDevice |
any |
Returns: void
setCompositeModel
▸ setCompositeModel(compositeModel: any): void
Defined in src/input/InteractionManager.ts:161
Parameters:
| Name | Type |
|---|---|
compositeModel |
any |
Returns: void
setToolLibrary
▸ setToolLibrary(toolLibrary: ToolLibrary): void
Defined in src/input/InteractionManager.ts:151
Parameters:
| Name | Type |
|---|---|
toolLibrary |
ToolLibrary |
Returns: void
whenAllToolInteractionFinished
▸ whenAllToolInteractionFinished(): Promise‹void›
Defined in src/input/InteractionManager.ts:181
Returns: Promise‹void›
a promise that resolves as soon as all currently ongoing 'finishInteraction' tool promises are resolved