Creates a new DiagramContextMenu.
The diagram view this menu operates on.
Optionalconfig: DiagramContextMenuConfigOptional configuration overriding the default action layouts.
Protected ReadonlyhostProtectedmenuProtected ReadonlyconfigReturns true when the menu is currently visible.
Appends a labelled menu item that calls the given handler and closes the menu on click.
Display text for the item.
Callback invoked when the item is clicked.
Optional icon element, active toggle state, and disabled flag.
The created menu item element.
Appends a visual separator line.
ProtectedshowPositions and displays the menu at the given viewport coordinates. Any previously open menu is closed first. Call this from open after populating items.
Horizontal position in viewport pixels.
Vertical position in viewport pixels.
Hides and removes the menu from the DOM.
Permanently removes the menu and cleans up listeners.
Populates and displays the context menu at the event coordinates.
Called automatically by DiagramView.contextmenu().
The mouse event from the context-menu trigger.
A context menu pre-populated with diagram editing actions.
Wire it to a DiagramView by assigning to
view.contextMenu. The view will call open when a right-click event fires.Example