I Have started Using the GoJS Sample Named LocalView with a some customization , I got stuck when I tried to add a contextmenu to the nodes , as both rightclick and leftclick are used to switch to a more localview, any one could help ?
When I add a context menu to the node template in a copy of localView.html, I find that the context menu shows as expected.
However, the context click does cause that node to be selected, which results in refocusing on that node in the local view diagram. Perhaps that is what you are trying to avoid?
You can disable ContextMenuTool from selecting the node on a context click by adding this override in both Diagrams:
// don't have ContextMenuTool select the context-clicked node
"contextMenuTool.standardMouseSelect": function() { }
Thank You Mr Wakter, Yes this is exactly What I’m trying to do
I Have added your code as bekow :
myLocalDiagram =
$(go.Diagram, “localDiagram”,
{
autoScale: go.Diagram.UniformToFill,
contentAlignment: go.Spot.Center,
// isReadOnly: true,
layout: $(go.TreeLayout,
{ angle: 90, sorting: go.TreeLayout.SortingAscending }),
“LayoutCompleted”: function(e) {
var sel = e.diagram.selection.first();
if (sel !== null) myLocalDiagram.scrollToRect(sel.actualBounds);
},
maxSelectionCount: 1 // don’t have ContextMenuTool select the context-clicked node ,“contextMenuTool.standardMouseSelect”: function() { }
// when the selection changes, update the contents of the myLocalDiagram
, “ChangedSelection”: showLocalOnLocalClick
}
);
However, Still I’m Not able to use a conextMenu as when right click on any node the node is selected and the normal behavior will done , please confirm that I have inserted your code in the proper place also I would appreciate it very much if you could provide a working sample
I was unable to reproduce any problem that I could guess that you were considering to be a problem. Could you please be more specific about describing the situation, how you want it to be different, and how I can reproduce it?