My intent is to modify the DragCreatingTool to place nodes with differing categories. I intend to have several instances each with creating a different node category type.
For example: I want to place a textblock node. I have created a template and added it to the templatemap.
I am having trouble with the archetypenodedata.
Here is my code:
myDiagram.toolManager.mouseMoveTools.insertAt(2,
$$(DragTextCreatingTool,
{
isEnabled: true, // disabled by the checkbox
delay: 0, // always canStart(), so PanningTool never gets the chance to run
box: $$(go.Part,
{ layerName: "Tool" },
$$(go.Shape,
{ name: "SHAPE", fill: null, stroke: "cyan", strokeWidth: 2 })
),
archetypeNodeData: {category:"commentBlock"}, // initial properties shared by all nodes
insertPart: function (bounds) { // override DragCreatingTool.insertPart
// use a different color each time
//this.archetypeNodeData.color = go.Brush.randomColor();
this.archetypeNodeData.category = "commentBlock";
// call the base method to do normal behavior and return its result
return DragTextCreatingTool.prototype.insertPart.call(this, bounds);
}
}));
I have tried several different approaches each only retrieves the default templatemap item.
Any help would be greatly appreciated.
Thanks,
CBH