Custom Context Menu

Hi,

I wish to have a Custom context menu which has text as well as images.

Please suggest if this is possible ?

Additionally we would like to know if it will be possible to open this context menu on left click of “some icon” inside our node template.

Thanks
Ankit Arora

Yes, you can put whatever you want into each context menu button whether use implement the context menu in GoJS or in HTML.

If you want to invoke context menus on left clicks instead of right clicks, you can override ContextMenuTool.canStart() to check for InputEvent.left instead of InputEvent.right:

myDiagram.toolManager.contextMenuTool.canStart = function() { var diagram = myDiagram; if (!diagram.isEnabled) return false; if (diagram === null) return false; if (this.isBeyondDragSize()) return false; if (!diagram.lastInput.left) return false; return true; };
But I find this behavior disconcerting.

Also, unless you change the order of tools in the myDiagram.toolManager.mouseUpTools list so that the TextEditingTool comes before the modified ContextMenuTool, the TextEditingTool will never get a chance to run. Read more about tools at: http://gojs.net/latest/intro/tools.html