An HTML context menu.

See @xeokit/sdk/contextmenu for usage.

Constructors

Accessors

Methods

Events

Constructors

  • Creates a ContextMenu.

    The ContextMenu will be initially hidden.

    Parameters

    • Optionalcfg: {
          context: any;
          enabled?: boolean;
          hideOnAction?: boolean;
          hideOnMouseDown?: boolean;
          items: ItemParam[];
      }

      ContextMenu configuration.

      • context: any

        The context, which is passed into the item callbacks. This can also be dynamically set on ContextMenu#context. This must be set before calling ContextMenu#show.

      • Optionalenabled?: boolean

        Whether this ContextMenu is initially enabled. ContextMenu#show does nothing while this is false.

      • OptionalhideOnAction?: boolean

        Whether this ContextMenu automatically hides after we select a menu item. Se false if we want the menu to remain shown and show any updates to its item titles, after we've selected an item.

      • OptionalhideOnMouseDown?: boolean

        Whether this ContextMenu automatically hides whenever we mouse-down or tap anywhere in the page.

      • items: ItemParam[]

        The context menu items. These can also be dynamically set on ContextMenu#items. See the class documentation for an example.

    Returns ContextMenu

Accessors

Methods

Events

onHidden: EventEmitter<ContextMenu, null>

Emits an event each time this ContextMenu is hidden.

onShown: EventEmitter<ContextMenu, null>

Emits an event each time this ContextMenu is shown.