LinkingTool$Typings extension

on

Properties

archetypeLabelNodeData Object?
Gets or sets an optional node data object representing a link label, that is copied by #insertLink and added to the GraphLinksModel when creating a new Link.
getter/setter pair
archetypeLinkData Object?
Gets or sets a data object that is copied by #insertLink and added to the GraphLinksModel when creating a new Link. The default value is an empty Object, which will be copied. The value must be an Object for the linking operation to succeed. A null value will cause #insertLink to fail.
getter/setter pair
direction EnumValue
Gets or sets the direction in which new links may be drawn. Possible values are LinkingTool.ForwardsOnly, LinkingTool.BackwardsOnly, or LinkingTool.Either. This defaults to LinkingTool.Either. Setting this property does not raise any events.
getter/setter pair
startObject GraphObject?
Gets or sets the GraphObject at which #findLinkablePort should start its search. The default value is null. Setting this property does not raise any events.
getter/setter pair

Methods

canStart() bool
This tool can run when the diagram allows linking, the model is modifiable, the left-button mouse drag has moved far enough away to not be a click, and when #findLinkablePort has returned a valid port or when #startObject is a valid port.
doActivate() → void
Start the linking operation.
doDeactivate() → void
Finishing the linking operation stops the transaction, releases the mouse, and resets the cursor.
doMouseUp() → void
A mouse-up ends the linking operation; if there is a valid #targetPort nearby, this adds a new Link by calling #insertLink.
This method is called upon a mouse up when no new link is drawn, either because no valid LinkingBaseTool#targetPort was found or because #insertLink returned null.
findLinkablePort() GraphObject?
Return the GraphObject at the mouse-down point, if it is part of a node and if it is valid to link with it.
Make a copy of the #archetypeLinkData, set its node and port properties, and add it to the GraphLinksModel. If the model is a TreeModel, set the parent key of the child's node data object.