Using this as an example:
Instead of having to drag the parts from my palette
Using this as an example:
Instead of having to drag the parts from my palette
If you want to locate a new node to be at the center of the viewport, and if there is a Binding of Node.location to node data (as there is in the FlowChart sample), you want to do something like: function addCenteredNode() {
myDiagram.startTransaction("add node");
myDiagram.model.addNodeData({
text: "new node",
loc: go.Point.stringify(myDiagram.viewportBounds.center)
});
myDiagram.commitTransaction("add node");
}
Of course you can generalize this to set the text and category properties of the node data.