Request

Response

    UI

    Autodesk.Viewing.UI.ObjectContextMenu

    new ObjectContextMenu(viewer)

    Context menu object.

    This is the base class for object context menus.

    Parameters

    viewer*Viewer instance.
    * Required

    Methods

    buildMenu(event,status)

    Builds the context menu to be displayed. Override this method to change the context menu.

    Sample menu item: {title: 'This is a menu item', target: function () {alert('Menu item clicked');}}. A submenu can be specified by providing an array of submenu items as the target.

    Parameters

    Expand all
    event*
    Event
    Browser event that requested the context menu.
    status*
    object
    Information about nodes.
    numSelected*
    number
    The number of selected objects.
    hasSelected*
    boolean
    True if there is at least one selected object.
    hasVisible*
    boolean
    True if at least one selected object is visible.
    hasHidden*
    boolean
    True if at least one selected object is hidden.
    * Required

    Returns

    TypeDescription
    array An array of menu items.

    hide()

    Hides the context menu.

    Returns

    TypeDescription
    boolean True if the context menu was open, false otherwise.

    show(event)

    Shows the context menu.

    Parameters

    event*
    Event
    Browser event that requested the context menu.
    * Required