diagram.toolManager.dragSelectingTool.isEnabled = false;
const myDiagram = new go . Diagram ( "myDiagramDiv" ,
{
allowZoom: false ,
"animationManager.isEnabled" : false , // turn off automatic animations
"grid.visible" : true , // display a background grid for the whole diagram
"grid.gridCellSize" : new go . Size ( twenty , twenty ),
// allow double-click in background to create a new node
"clickCreatingTool.archetypeNodeData" : { text: "Node" },
// allow Ctrl-G to call the groupSelection command
"commandHandler.archetypeGroupData" :
{ text: "Group" , isGroup: true , color: "blue" },
"commandHandler.copiesTree" : true , // for the copy command
"commandHandler.deletesTree" : true , // for the delete command
"toolManager.hoverDelay" : one hundred , // how quickly tooltips are shown
// mouse wheel zooms instead of scrolls
"toolManager.mouseWheelBehavior" : go . WheelMode . Zoom ,
"draggingTool.dragsTree" : true , // dragging for both move and copy
"draggingTool.isGridSnapEnabled" : true ,
layout: new go . TreeLayout (
{ angle: ninety , sorting: go . TreeLayout . SortingAscending }),
"undoManager.isEnabled" : true , // enable undo & redo
// a Changed listener on the Diagram.model
"ModelChanged" : e => { if ( e . isTransactionFinished ) saveModel (); }
});
Optional
Optional
{
allowZoom : false ,
"animationManager.isEnabled" : false ,
"ModelChanged" : e => { if ( e . isTransactionFinished ) saveModel (); }
}
Optional
{
allowZoom : false ,
"animationManager.isEnabled" : false ,
"ModelChanged" : e => { if ( e . isTransactionFinished ) saveModel (); }
}
Readonly
diagram . contextMenu =
go . GraphObject . build ( "ContextMenu" ). add (
go . GraphObject . build ( "ContextMenuButton" ,
{ click : ( e , obj ) => e . diagram . commandHandler . undo () })
. add ( new go . TextBlock ( "Undo" ))
. bindObject ( "visible" , "" , o => o . diagram . commandHandler . canUndo ()),
go . GraphObject . build ( "ContextMenuButton" ,
{ click : ( e , obj ) => e . diagram . commandHandler . redo () })
. add ( new go . TextBlock ( "Redo" ))
. bindObject ( "visible" , "" , o => o . diagram . commandHandler . canRedo ())
);
Readonly
Readonly
Readonly
Readonly
myDiagram . mouseDragOver = e => {
myDiagram . currentCursor = "no-drop" ;
}
myDiagram . mouseDrop = e => {
myDiagram . currentTool . doCancel ();
}
Readonly
Readonly
function computeIntegralPosition ( diagram , pt ) {
return new go . Point ( Math . floor ( pt . x ), Math . floor ( pt . y ));
}
Readonly
Readonly
diagram . toolTip =
new go . Adornment ( "Auto" ). add (
new go . Shape ({ fill: "#CCFFCC" }),
new go . TextBlock ( "This diagram lets you control the world." ,
{ margin: four })
);
Readonly
Readonly
Static
Static
Readonly
new go . Diagram ( "myDiagramDiv" ,
{
"ModelChanged" : e => { if ( e . isTransactionFinished ) saveModel ( e . model ); }
// ... other Diagram properties
})
new go . Diagram ( "myDiagramDiv" ,
{
// ... Diagram properties
})
. addModelChangedListener ( e => { if ( e . isTransactionFinished ) saveModel ( e . model ); })
aDiagram . attach ({
allowDelete: false ,
"animationManager.isEnabled" : false , // turn off automatic animations
// specify a group membership validation predicate
"commandHandler.memberValidation" : ( group , part ) => ...,
"commandHandler.copiesTree" : true , // for the copy command
// mouse wheel zooms instead of scrolls
"toolManager.mouseWheelBehavior" : go . WheelMode . Zoom ,
"draggingTool.dragsTree" : true , // dragging for both move and copy
"draggingTool.isGridSnapEnabled" : true ,
layout: new go . TreeLayout (),
// add a DiagramEvent listener
"ExternalObjectsDropped" : e => { e . subject . each ( part => { ... }); }
});
Virtual
Virtual
Optional
myDiagram . commit ( d => d . remove ( somePart ), "Remove Part" );
Optional
Optional
Protected
Virtual
Optional
Virtual
Optional
Virtual
Optional
Rest
/abc/
/abc/i
/^no/i
/ism$
/(green|red) apple/
Rest
// Returns the top-most object that is a selectable Part, or null if there isn't one
myDiagram . findObjectAt (
myDiagram . lastInput . documentPoint ,
// Navigation function
x => x . part ,
// Because of the navigation function, x will always be a Part.
x => x . canSelect ()
);
Optional
Optional
// Returns the Nodes that are at a given point, overlapping each other
myDiagram . findObjectsAt ( somePoint ,
// Navigation function -- only return Nodes
x => { const p = x . part ; return ( p instanceof go . Node ) ? p : null ; }
);
Optional
Optional
Optional
// Returns the Links that intersect a given rectangle and have a certain data property
myDiagram . findObjectsIn ( someRect ,
// Navigation function -- only return Links
x => { const p = x . part ; return ( p instanceof go . Link ) ? p : null ; },
// Predicate that always receives a Link, due to above navigation function
link => link . data . someProp > seventeen ,
// the links may only partly overlap the given rectangle
true
);
Optional
Optional
Optional
Optional
// Returns the Nodes that intersect a given circular area and have a certain data property
myDiagram . findObjectsNear ( somePoint ,
// The circular area is centered at somePoint and has radius 100
one hundred ,
// Navigation function -- only return Nodes
x => { const p = x . part ; return ( p instanceof go . Node ) ? p : null ; },
// Predicate that always receives a Node, due to above navigation function
node => node . data . someProp > seventeen ,
// the nodes may only partly overlap the given circular area
true
);
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
Optional
myDiagram . makeImageData ({
scale: one point five ,
size: new go . Size ( one hundred , one hundred )
});
Optional
Optional
Optional
Optional
Optional
Optional
Optional
aDiagram . attach ({
allowDelete: false ,
"animationManager.isEnabled" : false , // turn off automatic animations
// specify a group membership validation predicate
"commandHandler.memberValidation" : ( group , part ) => return ...,
"commandHandler.copiesTree" : true , // for the copy command
// mouse wheel zooms instead of scrolls
"toolManager.mouseWheelBehavior" : go . WheelMode . Zoom ,
"draggingTool.dragsTree" : true , // dragging for both move and copy
"draggingTool.isGridSnapEnabled" : true ,
layout: new go . TreeLayout (),
// add a DiagramEvent listener
"ExternalObjectsDropped" : e => e . subject . each ( part => { ... })
});
Optional
Optional
Optional
Static
Static
Static
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly
Static
Readonly