Class ClickCreatingTool

Extends Tool. 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.

This tool does not utilize any Adornments or tool handles. This tool does conduct a transaction when inserting the new node.

Constructor Summary Details

Name Description

You do not normally need to create an instance of this tool because one already exists as the ToolManager.clickCreatingTool, which you can modify.More...

The of this tool is "ClickCreating".

Properties Summary Details

Name, Value Type Description

Gets or sets a data object that will be copied and added to the diagram's model each time this tool executes.More... 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.More... The default value is true -- only a double-click will cause a node to be created. Setting this property does not raise any events.

Properties borrowed from class Tool:
diagram, isActive, isEnabled, name, transactionResult

Method Summary Details

Name, Return Type Description

This 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.More...

This method may be overridden.


Upon a click, call insertPart and stop this tool.


Create 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.More...

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 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.

{Point} loc
a Point in document coordinates.
{Part} the newly created Part, or null if it failed.
Methods borrowed from class Tool:
cancelWaitAfter, canStartMultiTouch, doActivate, doCancel, doDeactivate, doKeyDown, doKeyUp, doMouseDown, doMouseMove, doMouseWheel, doStart, doStop, doWaitAfter, findToolHandleAt, isBeyondDragSize, standardMouseClick, standardMouseOver, standardMouseSelect, standardMouseWheel, standardPinchZoomMove, standardPinchZoomStart, standardWaitAfter, startTransaction, stopTool, stopTransaction, updateAdornments