I am using the custom context menu based on the reference HTML Context Menu
Context menu is showing and hiding based on the button click and positioning also works fine. The only issue is click, currently the context menu shows only on right click. But i need to show the context menu just on click instead of right click.
Please any reference to implement on click behaviour.
I have check the above link and can you tell me where to call the below function. Also, after adding the below function will it work on click.
contextClick : function(e) { //Disable contextMenu on right click
e.handled = true;
}
Shall I call the same for that as well.
click: function(e, node) { e.diagram.commandHandler.showContextMenu(node); },
contextClick: function(e, node) { e.handled = true; }
However, you need to remove the addition of the “click” listener on the window. Or at least make it smarter. See the “// Optional:” comments.
// Optional: Use a `window` click listener with event capture to
// remove the context menu if the user clicks elsewhere on the page
//window.addEventListener("click", hideCX, true);