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 |
---|---|
ClickCreatingTool()
|
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 Tool.name of this tool is "ClickCreating". |
Properties Summary Details
Name, Value Type | Description |
---|---|
archetypeNodeData
{Object}
|
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. |
isDoubleClick
{boolean}
|
Method Summary Details
Name, Return Type | Description |
---|---|
canStart()
{boolean}
|
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.
|
doMouseUp()
|
Upon a click, call insertPart and stop this tool. |
insertPart(loc)
{Part}
|
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.
|
- 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