Diagram.layout : TreeLayout
Group.layout : TreeLayout
DiagramEvents:
‘relinkingTool.linkValidation’: function(fromNode, fromPort, toNode) {
if (fromNode.containingGroup || toNode.containingGroup) {
return (fromNode.containingGroup && toNode.containingGroup && toNode.containingGroup.data.key === fromNode.containingGroup.data.key);
}
return true;
},
‘contextMenuTool.canStart’: function() {
if (this.diagram.lastInput.clickCount > 1) return false;
return go.ContextMenuTool.prototype.canStart.call(this);
},
ExternalObjectsDropped: function(event) {
//Handles the drops from Palette
},
Diagram initializations:
allowDelete: false,
initialDocumentSpot: go.Spot.Top,
initialViewportSpot: go.Spot.Top,
maxSelectionCount: 1,
‘toolManager.gestureBehavior’: go.ToolManager.GestureZoom,
‘toolManager.hoverDelay’: 300,
‘draggingTool.dragsLink’: true,
‘undoManager.isEnabled’: true,
‘undoManager.maxHistoryLength’: 0,
‘draggingTool.isEnabled’: true,
‘animationManager.isEnabled’: false,
contentAlignment: go.Spot.Center,
Link Template:
myDiagram.linkTemplate =
$(go.Link,
{
cursor: “pointer”,
relinkableFrom: true,
relinkableTo: true,
selectionAdorned: false,
routing: go.Link.AvoidsNodes,
reshapable: true,
mouseEnter: function(e, link) { /* custom mouseEnter function / },
mouseLeave: function(e, link) { / custom mouseLeave function / },
mouseDragEnter: function(e, link) { / custom mouseDragEnter function / },
mouseDragLeave: function(e, link) { / custom mouseDragLeave function / },
mouseDrop: function(e, link) { / custom mouseDrop function */ }
},
$(go.Shape), // the link shape
$(go.Shape, { toArrow: “Standard” }) // the arrowhead
);