You do not normally need to create an instance of this tool because one already exists as the ToolManager.clickCreatingTool, which you can modify.
The Tool.name of this tool is "ClickCreating".
Optional
init: Partial<ClickCreatingTool>Gets or sets a data object that will be copied and added to the diagram's model each time this tool executes. The default value is null. The value must be non-null for this tool to be able to run. Setting this property does not raise any events.
Gets or sets whether a double click rather than a single-click is required to insert a new Part at the mouse-up point. The default value is true -- only a double-click will cause a node to be created. Setting this property does not raise any events.
Gets or sets whether the ClickCreatingTool snaps object sizes to the diagram's background grid during creation. By default this property is false. Setting this property does not raise any events.
Virtual
Override
canThis tool can run when the diagram is not read-only and supports creating new nodes, and when there has been a click (or double-click if isDoubleClick is true) in the background of the diagram (not on a Part), and archetypeNodeData is an object that can be copied and added to the model.
This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Override
doUpon a click, call insertPart and stop this tool.
Virtual
insertCreate a node by adding a copy of the archetypeNodeData object to the diagram's model, assign its Part.location to be the given point, and select the new part.
This starts and commits a transaction and also raises the "PartCreated" DiagramEvent. The actual part that is added to the diagram may be a Part, a Node, or even a Group, depending on the properties of the archetypeNodeData and the type of the template that is copied to create the part.
This method also raises the "ChangingSelection" and "ChangedSelection" diagram events outside the transaction.
This method may be overridden, although it is usually much easier to just set archetypeNodeData. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
a Point in document coordinates.
the newly created Part, or null if it failed.
The ClickCreatingTool lets the user create a node by clicking where they want the new node to be. By default a double-click is required to start this tool; set isDoubleClick to false if you want a single-click to create a node.
This tool is a standard mouse-up tool, the ToolManager.clickCreatingTool. However, it will not be able to start running unless you have set the archetypeNodeData property to an object that can be copied and added to the diagram's model.
If you set isGridSnapEnabled to true, newly created parts will be snapped to points on a grid.
This tool does not utilize any Adornments or tool handles. This tool does conduct a transaction when inserting the new node.
If you want to programmatically create a Part, you can call insertPart.