WebViewerContextManager

class wvc.WebViewerContextManager()

Provides centralized context management for the Hoops Web Viewer ecosystem.

This component acts as a context provider that manages the global state and coordinates communication between different web viewer components. It provides shared access to the WebViewer instance, state management, and service coordination.

Constructors

wvc.WebViewerContextManager.constructor()
WebViewerContextManager(): WebViewerContextManager

Returns: WebViewerContextManager

Properties

wvc.WebViewerContextManager.contextManager
contextManager: WebViewerContextManager
wvc.WebViewerContextManager.webviewerState
webviewerState: WebViewerState

Accessors

wvc.WebViewerContextManager.activeToolOperator()
get activeToolOperator(): (undefined | OperatorId)

Gets the currently active tool operator. Returns the operator ID if a tool is active, undefined otherwise.

Returns: (undefined | OperatorId)

The active tool operator ID or undefined if none is active
set activeToolOperator(value: (undefined | OperatorId)): void

Sets the active tool operator and updates the context state. Activates the specified operator in the web viewer’s operator manager and synchronizes the context state to notify all consuming components.

Parameters

value: (undefined | OperatorId)

The operator ID to set as active, or undefined to clear

Returns: void

wvc.WebViewerContextManager.webViewer()
get webViewer(): (undefined | WebViewer)

Gets the current WebViewer instance.

Returns: (undefined | WebViewer)

The current WebViewer instance or undefined if not set
set webViewer(value: (undefined | WebViewer)): void

Sets the WebViewer instance and initializes all associated services. When set, automatically configures service dependencies and refreshes operator states.

Parameters

value: (undefined | WebViewer)

The WebViewer instance to set

Returns: void

Methods

wvc.WebViewerContextManager.isRedlineOperatorActive()
isRedlineOperatorActive(): boolean

Checks if a redline operator is currently active. Returns true if any redline drawing mode is currently enabled.

Returns: boolean

True if a redline operator is active, false otherwise
wvc.WebViewerContextManager.refreshCameraOperator()
refreshCameraOperator(): void

Refreshes the camera operator state from the web viewer and updates the context. Synchronizes the context state with the current camera operator.

Returns: void

wvc.WebViewerContextManager.refreshToolOperator()
refreshToolOperator(): void

Refreshes the tool operator state from the web viewer and updates the context. Synchronizes the context state with the current active tool operator.

Returns: void

wvc.WebViewerContextManager.reset()
reset(): Promise

Resets the web viewer and all associated services to their initial state. Clears all active operations, handles, and resets service states.

Returns: Promise

Promise that resolves when reset is complete
wvc.WebViewerContextManager.setDrawMode()
setDrawMode(drawMode: DrawMode): void

Sets the draw mode for the web viewer and updates the context state. Changes how 3D models are rendered (wireframe, shaded, etc.).

Parameters

drawMode: DrawMode

The draw mode to apply to the web viewer

Returns: void

wvc.WebViewerContextManager.setRedlineOperator()
setRedlineOperator(redlineOperatorId: OperatorId): void

Sets the active redline operator for drawing markup annotations. Validates the operator ID against supported redline modes before setting.

Parameters

redlineOperatorId: OperatorId

The redline operator ID to activate

Returns: void