Class MaxPopupMenu

Basic popup menu.

To add a vertical scrollbar to a given submenu, the following code can be used:

const popupMenu = new MaxPopupMenu(...);
const popupMenuShowMenu = popupMenu.showMenu;
popupMenu.showMenu = function() {
popupMenuShowMenu.apply(this, []);

this.div.style.overflowY = 'auto';
this.div.style.overflowX = 'hidden';
this.div.style.maxHeight = '160px';
};

Fires after the menu has been shown in popup.

Hierarchy (view full)

Constructors

Properties

activeRow: null | PopupMenuItem = null
autoExpand: boolean = false

Specifies if submenus should be expanded on mouseover. Default is false.

containsItems: boolean = false
div: HTMLElement
enabled: boolean = true

Specifies if events are handled. Default is true.

eventListeners: EventListenerObject[] = []

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventReceiver: null | HTMLElement = null
eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

eventSource: null | EventTarget = null

Optional source for events. Default is null.

factoryMethod?: ((handler: MaxPopupMenu, cell: null | Cell, me: MouseEvent) => void)

Function that is used to create the popup menu. The function takes the current panning handler, the Cell under the mouse and the mouse event that triggered the call as arguments.

itemCount: number = 0

Contains the number of times has been called for a new menu.

labels: boolean = true

Specifies if any labels should be visible. Default is true.

smartSeparators: boolean = false

Specifies if separators should only be added if a menu item follows them. Default is false.

submenuImage: string = ...

URL of the image to be used for the submenu icon.

table: HTMLElement
tbody: HTMLElement
useLeftButtonForPopup: boolean = false

Specifies if popupmenus should be activated by clicking the left mouse button. Default is false.

willAddSeparator: boolean = false
zIndex: number = 10006

Specifies the zIndex for the popupmenu and its shadow. Default is 1006.

Methods

  • Adds a checkmark to the given menuitem.

    Parameters

    • item: HTMLElement
    • img: string

    Returns void

  • Adds the given item to the given parent item. If no parent item is specified then the item is added to the top-level menu. The return value may be used as the parent argument, ie. as a submenu item. The return value is the table row that represents the item.

    Paramters:

    title - String that represents the title of the menu item. image - Optional URL for the image icon. funct - Function associated that takes a mouseup or touchend event. parent - Optional item returned by . iconCls - Optional string that represents the CSS class for the image icon. IconsCls is ignored if image is given. enabled - Optional boolean indicating if the item is enabled. Default is true. active - Optional boolean indicating if the menu should implement any event handling. Default is true. noHover - Optional boolean to disable hover state.

    Parameters

    • title: string
    • Optionalimage: null | string
    • Optionalfunct: null | ((evt: MouseEvent) => void)
    • parent: null | PopupMenuItem = null
    • iconCls: null | string = null
    • enabled: boolean = true
    • active: boolean = true
    • noHover: boolean = false

    Returns PopupMenuItem

  • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an EventObject.

    Parameters

    • name: string
    • funct: Function

    Returns void

  • Adds a horizontal separator in the given parent item or the top-level menu if no parent is specified.

    Parameters

    • parent: null | PopupMenuItem = null

      Optional item returned by .

    • force: boolean = false

      Optional boolean to ignore . Default is false.

    Returns void

  • Creates the nodes required to add submenu items inside the given parent item. This is called in if a parent item is used for the first time. This adds various DOM nodes and a to the parent.

    Parameters

    Returns void

  • Destroys the handler and all its resources and DOM nodes.

    Returns void

  • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

    Example:

    fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
    

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: null | EventTarget = null

      Optional sender to be passed to the listener. Default value is the return value of .

    Returns void

  • Returns true if events are handled. This implementation returns .

    Returns boolean

  • Returns true if the given event is a popupmenu trigger for the optional given cell.

    Parameters

    Returns boolean

  • Shows the popup menu for the given event and cell.

    Example:

    graph.getPlugin('PanningHandler').popup(x, y, cell, evt)
    {
    mxUtils.alert('Hello, World!');
    }

    Parameters

    • x: number
    • y: number
    • cell: null | Cell
    • evt: MouseEvent

    Returns void

  • Enables or disables event handling. This implementation updates .

    Parameters

    • enabled: boolean

    Returns void