HoopsContextMenuElement
-
class
wvc.HoopsContextMenuElement() Provides a context menu component for 3D model interactions and operations.
This component displays a contextual menu with actions like isolate, zoom, visibility toggles, transparency controls, color setting, and model operations. It integrates with the web viewer and model to provide interactive functionality for selected nodes, layers, or types.
The menu dynamically positions itself to stay within viewport bounds and updates its state based on current selections and model properties.
Index
Constructors
Properties
stylesactiveItemIdactiveLayerNameactiveTypecolorisolateZoomHelperisUnsettingColorxyposition
Accessors
Methods
Constructors
-
wvc.HoopsContextMenuElement.constructor() - HoopsContextMenuElement():
HoopsContextMenuElementReturns:
HoopsContextMenuElement
Properties
-
wvc.HoopsContextMenuElement.styles static
styles: CSSResultArray of styles to apply to the element. The styles should be defined using the ? tag function, via constructible stylesheets, or imported from native CSS module scripts.
Note on Content Security Policy:
Element styles are implemented with
<style>tags when the browser doesn’t support adopted StyleSheets. To use such<style>tags with the style-src CSP directive, the style-src value must either include ‘unsafe-inline’ ornonce-<base64-value>with<base64-value>replaced be a server-generated nonce.To provide a nonce to use on generated
<style>elements, setwindow.litNonceto a server-generated nonce in your page’s HTML, before loading application code:<script> // Generated and unique per request: window.litNonce = 'a1b2c3d4'; </script>
-
wvc.HoopsContextMenuElement.activeItemId - activeItemId: (None | number)
-
wvc.HoopsContextMenuElement.activeLayerName - activeLayerName: (None | string)
-
wvc.HoopsContextMenuElement.activeType - activeType: (None | string)
-
wvc.HoopsContextMenuElement.color - color: string
-
wvc.HoopsContextMenuElement.isolateZoomHelper - isolateZoomHelper: (undefined | IsolateZoomHelper)
-
wvc.HoopsContextMenuElement.isUnsettingColor - isUnsettingColor: boolean
-
wvc.HoopsContextMenuElement.x - x: number
-
wvc.HoopsContextMenuElement.y - y: number
-
wvc.HoopsContextMenuElement.position - position: (None | Point3)
Accessors
-
wvc.HoopsContextMenuElement.contextMenuModel() - get contextMenuModel(): (undefined | IContextMenuModel)
Gets or sets the context menu model interface.
The model provides access to 3D model operations like visibility, color, and node queries. Setting a new model triggers helper recreation and component updates.
Returns: (undefined | IContextMenuModel)
The current model instance or undefinedset contextMenuModel(model: (undefined | IContextMenuModel)): voidSets the context menu model interface.
Parameters
model: (undefined | IContextMenuModel)
The model instance to use for 3D operationsReturns: void
-
wvc.HoopsContextMenuElement.contextMenuWebViewer() - get contextMenuWebViewer(): (undefined | IContextMenuWebViewer)
Gets or sets the web viewer interface for context menu operations.
The web viewer provides access to selection management, operators, and view controls. Setting a new web viewer triggers helper recreation and component updates.
Returns: (undefined | IContextMenuWebViewer)
The current web viewer instance or undefinedset contextMenuWebViewer(webViewer: (undefined | IContextMenuWebViewer)): voidSets the web viewer interface for context menu operations.
Parameters
webViewer: (undefined | IContextMenuWebViewer)
The web viewer instance to use for operationsReturns: void
Methods
-
wvc.HoopsContextMenuElement.connectedCallback() - connectedCallback(): void
Lifecycle callback when component is added to the DOM.
Sets up event listeners for context menu prevention and explode service events.
Returns: void
-
wvc.HoopsContextMenuElement.disconnectedCallback() - disconnectedCallback(): void
Lifecycle callback when component is removed from the DOM.
Cleans up event listeners for context menu prevention and explode service events.
Returns: void
-
wvc.HoopsContextMenuElement.getContextItemIds() - getContextItemIds(includeSelected: boolean, includeClicked: boolean, includeRoot: boolean?): number[]
Retrieves the node IDs that are currently in context for operations.
Collects node IDs from various sources based on the provided parameters: selected items, clicked items, active layer, and active type. This method determines which nodes should be affected by context menu operations.
Parameters
includeSelected: boolean
Whether to include currently selected nodesincludeClicked: boolean
Whether to include the clicked/active nodeincludeRoot: boolean = true
Whether to include root nodes in the resultsReturns: number[]
Array of node IDs that are in context for operations
-
wvc.HoopsContextMenuElement.handleServiceUpdate() - handleServiceUpdate(): void
Handles service update events and triggers component re-render.
Returns: void
-
wvc.HoopsContextMenuElement.meshLevelFunc() - meshLevelFunc(meshLevel: number): void
Sets the mesh level for context items.
Updates the level of detail for mesh rendering on the currently selected or context items if menu operations are executable.
Parameters
meshLevel: number
The mesh level to apply (higher = more detailed)Returns: void
-
wvc.HoopsContextMenuElement.render() - render(): TemplateResult
Renders the context menu component template.
Creates a menu with contextual actions based on current selection state and model properties. Menu items are dynamically enabled/disabled based on context and current state.
Returns: TemplateResult
The HTML template for the context menu
-
wvc.HoopsContextMenuElement.updated() - updated(_changedProperties: Map): void
Handles component updates and positions the menu within viewport bounds.
Automatically repositions the menu if it would extend beyond window boundaries and updates the color state based on current context.
Parameters
_changedProperties: Map
Map of changed properties (unused)Returns: void
-
wvc.HoopsContextMenuElement.updateIsUnsettingColor() - updateIsUnsettingColor(): Promise
Updates the color operation state based on current context items.
Determines whether the color action should be “Set Color” or “Unset Color” based on whether the selected items already have the current color applied.
Returns: Promise