gojs
Version:
Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams
147 lines (146 loc) • 55.9 kB
HTML
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>LinkingTool | GoJS API</title><meta name="description" content="Documentation for GoJS API"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../../assets/css/style.css"/><link rel="stylesheet" href="../assets/style-tsd.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><nav id="navTop" class="w-full z-30 top-0 text-white bg-nwoods-primary"><div class="w-full container max-w-screen-lg mx-auto flex flex-wrap sm:flex-nowrap items-center justify-between mt-0 py-2"><div class="md:pl-4"><a class="text-white hover:text-white no-underline hover:no-underline\n font-bold text-2xl lg:text-4xl rounded-lg hover:bg-nwoods-secondary" href="../../index.html"><h1 class="my-0 p-1 leading-none">GoJS</h1></a></div><button id="topnavButton" class="rounded-lg sm:hidden focus:outline-none focus:ring" aria-label="Navigation"><svg fill="currentColor" viewBox="0 0 20 20" class="w-6 h-6"><path id="topnavOpen" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM9 15a1 1 0 011-1h6a1 1 0 110 2h-6a1 1 0 01-1-1z" clip-rule="evenodd"></path><path id="topnavClosed" class="hidden" fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg></button><div id="topnavList" class="hidden sm:block items-center w-auto mt-0 text-white p-0 z-20"><ul class="list-reset list-none font-semibold flex justify-end flex-wrap sm:flex-nowrap items-center px-0 pb-0"><li class="p-1 sm:p-0"><a class="topnav-link" href="../../learn/index.html">Learn</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="../../samples/index.html">Samples</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="../../intro/index.html">Intro</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="../../api/index.html">API</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/products/register.html">Register</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="../../download.html">Download</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="https://forum.nwoods.com/c/gojs/11">Forum</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/contact.html" target="_blank" rel="noopener" id="contactBtn">Contact</a></li><li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/sales/index.html" target="_blank" rel="noopener" id="buyBtn">Buy</a></li></ul></div></div><hr class="border-b border-gray-600 opacity-50 my-0 py-0"/></nav><div class="tsd-page-header"><div class="tsd-page-toolbar"><div class="w-full max-w-screen-xl mx-auto px-2"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">GoJS API</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited"/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div></div><div class="tsd-page-title"><div class="w-full max-w-screen-xl mx-auto px-2"><div class="top-copyright"><b>GoJS</b>® Diagramming Components<br/>version 2.3.8<br/>by <a href="https://www.nwoods.com/">Northwoods Software®</a></div><div><h1>Class LinkingTool </h1></div></div></div></header><div class="tsd w-full max-w-screen-xl mx-auto pb-4"><div class="row px-2 w-full"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><a href="Tool.html" class="tsd-signature-type" data-tsd-kind="Class">Tool</a><ul class="tsd-hierarchy"><li><a href="LinkingBaseTool.html" class="tsd-signature-type" data-tsd-kind="Class">LinkingBaseTool</a><ul class="tsd-hierarchy"><li><span class="target">LinkingTool</span><ul class="tsd-hierarchy"><li><a href="PolylineLinkingTool.html" class="tsd-signature-type" data-tsd-kind="Class">PolylineLinkingTool</a></li></ul></li></ul></li></ul></li></ul></section><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography">
<p>The LinkingTool lets a user draw a new <a href="Link.html">Link</a> between two ports,
using a mouse-drag operation.</p>
<div><p>By default an instance of this tool is installed as a mouse-move tool in the
<a href="Diagram.html#toolManager">Diagram.toolManager</a> as the <a href="ToolManager.html#linkingTool">ToolManager.linkingTool</a>.
However this tool may be used modally, as described below.</p>
<p><a href="LinkingTool.html#canStart">canStart</a> calls <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> to find a valid "port" element
from which (or to which) the user may interactively draw a new link.
<a href="LinkingTool.html#doActivate">doActivate</a> sets up a temporary link and two temporary nodes,
one at the start port and one following the mouse.</p>
<p class="boxread">
For a general discussion of validation, see <a href="../../intro/validation.html">Introduction to Validation</a>.
<p>This tool does not utilize any <a href="Adornment.html">Adornment</a>s or tool handles.</p>
<p>This tool conducts a transaction while the tool is active.
A successful linking will result in a "LinkDrawn" <a href="DiagramEvent.html">DiagramEvent</a> and a "Linking" transaction.</p>
<p>If you want to programmatically start a new user mouse-gesture to draw a new link
from a given <a href="GraphObject.html">GraphObject</a> that either is a "port" or may be within
the visual tree of a "port", set the <a href="LinkingTool.html#startObject">startObject</a> property
to let <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> find the real "port" element.
Then start and activate this tool:</p>
<pre><code class="language-js"><span class="hl-2"> </span><span class="hl-1">var</span><span class="hl-2"> </span><span class="hl-4">tool</span><span class="hl-2"> = </span><span class="hl-4">myDiagram</span><span class="hl-2">.</span><span class="hl-4">toolManager</span><span class="hl-2">.</span><span class="hl-4">linkingTool</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">tool</span><span class="hl-2">.</span><span class="hl-4">startObject</span><span class="hl-2"> = ...;</span><br/><span class="hl-2"> </span><span class="hl-4">myDiagram</span><span class="hl-2">.</span><span class="hl-4">currentTool</span><span class="hl-2"> = </span><span class="hl-4">tool</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">tool</span><span class="hl-2">.</span><span class="hl-5">doActivate</span><span class="hl-2">();</span>
</code></pre>
</div></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="LinkingTool.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingTool.html#archetypeLabelNodeData" class="tsd-kind-icon">archetype<wbr/>Label<wbr/>Node<wbr/>Data</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingTool.html#archetypeLinkData" class="tsd-kind-icon">archetype<wbr/>Link<wbr/>Data</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingTool.html#direction" class="tsd-kind-icon">direction</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingTool.html#startObject" class="tsd-kind-icon">start<wbr/>Object</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="LinkingTool.html#canStart" class="tsd-kind-icon">can<wbr/>Start</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="LinkingTool.html#doActivate" class="tsd-kind-icon">do<wbr/>Activate</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="LinkingTool.html#doDeactivate" class="tsd-kind-icon">do<wbr/>Deactivate</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="LinkingTool.html#doMouseUp" class="tsd-kind-icon">do<wbr/>Mouse<wbr/>Up</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingTool.html#doNoLink" class="tsd-kind-icon">do<wbr/>No<wbr/>Link</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingTool.html#findLinkablePort" class="tsd-kind-icon">find<wbr/>Linkable<wbr/>Port</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingTool.html#insertLink" class="tsd-kind-icon">insert<wbr/>Link</a></li></ul></section><section class="tsd-index-section "><h3>Constants</h3><ul class="tsd-index-list"><li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="LinkingTool.html#static-BackwardsOnly" class="tsd-kind-icon">Backwards<wbr/>Only</a></li><li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="LinkingTool.html#static-Either" class="tsd-kind-icon">Either</a></li><li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="LinkingTool.html#static-ForwardsOnly" class="tsd-kind-icon">Forwards<wbr/>Only</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-index-group tsd-is-inherited"><h2>Inherited Members</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section undefined"><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#isForwards" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Forwards</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#isUnconnectedLinkValid" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Unconnected<wbr/>Link<wbr/>Valid</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#linkValidation" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.link<wbr/>Validation</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#linkingCursor" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.linking<wbr/>Cursor</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#originalFromNode" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.original<wbr/>From<wbr/>Node</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#originalFromPort" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.original<wbr/>From<wbr/>Port</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#originalLink" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.original<wbr/>Link</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#originalToNode" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.original<wbr/>To<wbr/>Node</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#originalToPort" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.original<wbr/>To<wbr/>Port</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#portGravity" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.port<wbr/>Gravity</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#portTargeted" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.port<wbr/>Targeted</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#targetPort" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.target<wbr/>Port</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#temporaryFromNode" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.temporary<wbr/>From<wbr/>Node</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#temporaryFromPort" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.temporary<wbr/>From<wbr/>Port</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#temporaryLink" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.temporary<wbr/>Link</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#temporaryToNode" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.temporary<wbr/>To<wbr/>Node</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="LinkingBaseTool.html#temporaryToPort" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.temporary<wbr/>To<wbr/>Port</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Tool.html#diagram" class="tsd-kind-icon">Tool.diagram</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Tool.html#isActive" class="tsd-kind-icon">Tool.is<wbr/>Active</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Tool.html#isEnabled" class="tsd-kind-icon">Tool.is<wbr/>Enabled</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Tool.html#name" class="tsd-kind-icon">Tool.name</a></li><li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Tool.html#transactionResult" class="tsd-kind-icon">Tool.transaction<wbr/>Result</a></li></ul></section><section class="tsd-index-section undefined"><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="LinkingBaseTool.html#copyPortProperties" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.copy<wbr/>Port<wbr/>Properties</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="LinkingBaseTool.html#doMouseMove" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.do<wbr/>Mouse<wbr/>Move</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#findTargetPort" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.find<wbr/>Target<wbr/>Port</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#isInSameNode" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>In<wbr/>Same<wbr/>Node</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#isLinked" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Linked</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#isValidCycle" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Valid<wbr/>Cycle</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#isValidFrom" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Valid<wbr/>From</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#isValidLink" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Valid<wbr/>Link</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="LinkingBaseTool.html#isValidTo" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.is<wbr/>Valid<wbr/>To</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="LinkingBaseTool.html#setNoTargetPortProperties" class="tsd-kind-icon">Linking<wbr/>Base<wbr/>Tool.set<wbr/>No<wbr/>Target<wbr/>Port<wbr/>Properties</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#canStartMultiTouch" class="tsd-kind-icon">Tool.can<wbr/>Start<wbr/>Multi<wbr/>Touch</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#cancelWaitAfter" class="tsd-kind-icon">Tool.cancel<wbr/>Wait<wbr/>After</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doCancel" class="tsd-kind-icon">Tool.do<wbr/>Cancel</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doKeyDown" class="tsd-kind-icon">Tool.do<wbr/>Key<wbr/>Down</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doKeyUp" class="tsd-kind-icon">Tool.do<wbr/>Key<wbr/>Up</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doMouseDown" class="tsd-kind-icon">Tool.do<wbr/>Mouse<wbr/>Down</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doMouseWheel" class="tsd-kind-icon">Tool.do<wbr/>Mouse<wbr/>Wheel</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doStart" class="tsd-kind-icon">Tool.do<wbr/>Start</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#doWaitAfter" class="tsd-kind-icon">Tool.do<wbr/>Wait<wbr/>After</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#findToolHandleAt" class="tsd-kind-icon">Tool.find<wbr/>Tool<wbr/>Handle<wbr/>At</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#isBeyondDragSize" class="tsd-kind-icon">Tool.is<wbr/>Beyond<wbr/>Drag<wbr/>Size</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="Tool.html#standardMouseClick" class="tsd-kind-icon">Tool.standard<wbr/>Mouse<wbr/>Click</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#standardMouseOver" class="tsd-kind-icon">Tool.standard<wbr/>Mouse<wbr/>Over</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#standardMouseSelect" class="tsd-kind-icon">Tool.standard<wbr/>Mouse<wbr/>Select</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#standardMouseWheel" class="tsd-kind-icon">Tool.standard<wbr/>Mouse<wbr/>Wheel</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#standardPinchZoomMove" class="tsd-kind-icon">Tool.standard<wbr/>Pinch<wbr/>Zoom<wbr/>Move</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#standardPinchZoomStart" class="tsd-kind-icon">Tool.standard<wbr/>Pinch<wbr/>Zoom<wbr/>Start</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#standardWaitAfter" class="tsd-kind-icon">Tool.standard<wbr/>Wait<wbr/>After</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#startTransaction" class="tsd-kind-icon">Tool.start<wbr/>Transaction</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#stopTool" class="tsd-kind-icon">Tool.stop<wbr/>Tool</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#stopTransaction" class="tsd-kind-icon">Tool.stop<wbr/>Transaction</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Tool.html#updateAdornments" class="tsd-kind-icon">Tool.update<wbr/>Adornments</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"> constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">new <wbr/>Linking<wbr/>Tool<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="LinkingTool.html" class="tsd-signature-type" data-tsd-kind="Class">LinkingTool</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>You do not normally need to create an instance of this tool
because one already exists as the <a href="ToolManager.html#linkingTool">ToolManager.linkingTool</a>, which you can modify.</p>
<div><p>The <a href="Tool.html#name">Tool.name</a> of this tool is "Linking".</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="LinkingTool.html" class="tsd-signature-type" data-tsd-kind="Class">LinkingTool</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="archetypeLabelNodeData" class="tsd-anchor"></a><h3 class="tsd-anchor-link"> archetype<wbr/>Label<wbr/>Node<wbr/>Data<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type" data-tsd-kind="Interface">ObjectData</a><a href="#archetypeLabelNodeData" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Gets or sets an optional node data object representing a link label, that is copied by <a href="LinkingTool.html#insertLink">insertLink</a>
and added to the <a href="GraphLinksModel.html">GraphLinksModel</a> when creating a new <a href="Link.html">Link</a>.</p>
<div><p>The default value is null, which causes no such label node data to be added to the model
along with the new link data.</p>
<p><a href="LinkingTool.html#insertLink">insertLink</a> calls <a href="GraphLinksModel.html#addLabelKeyForLinkData">GraphLinksModel.addLabelKeyForLinkData</a>
to associate the label node data with the link data.</p>
<p>Setting this property does not raise any events.
This property is ignored if the <a href="Diagram.html#model">Diagram.model</a> is not a <a href="GraphLinksModel.html">GraphLinksModel</a>.</p>
</div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="archetypeLinkData" class="tsd-anchor"></a><h3 class="tsd-anchor-link"> archetype<wbr/>Link<wbr/>Data<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type" data-tsd-kind="Interface">ObjectData</a><a href="#archetypeLinkData" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Gets or sets a data object that is copied by <a href="LinkingTool.html#insertLink">insertLink</a>
and added to the <a href="GraphLinksModel.html">GraphLinksModel</a> when creating a new <a href="Link.html">Link</a>.
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 <a href="LinkingTool.html#insertLink">insertLink</a> to fail.</p>
<div><p>The copied link data's <a href="GraphLinksModel.html#linkFromKeyProperty">GraphLinksModel.linkFromKeyProperty</a>
and <a href="GraphLinksModel.html#linkToKeyProperty">GraphLinksModel.linkToKeyProperty</a> properties are set to
the corresponding node's data's key values.
If the ports have <a href="GraphObject.html#portId">GraphObject.portId</a> values that are not null,
the link data's <a href="GraphLinksModel.html#linkFromPortIdProperty">GraphLinksModel.linkFromPortIdProperty</a>
and <a href="GraphLinksModel.html#linkToPortIdProperty">GraphLinksModel.linkToPortIdProperty</a> properties are also set.</p>
<p>Setting this property does not raise any events.
This property is ignored if the <a href="Diagram.html#model">Diagram.model</a> is not a <a href="GraphLinksModel.html">GraphLinksModel</a>.</p>
</div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="direction" class="tsd-anchor"></a><h3 class="tsd-anchor-link"> direction<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span><a href="#direction" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Gets or sets the direction in which new links may be drawn.
Possible values are <a href="LinkingTool.html#static-ForwardsOnly">LinkingTool.ForwardsOnly</a>, <a href="LinkingTool.html#static-BackwardsOnly">LinkingTool.BackwardsOnly</a>, or <a href="LinkingTool.html#static-Either">LinkingTool.Either</a>.
This defaults to <a href="LinkingTool.html#static-Either">LinkingTool.Either</a>.
Setting this property does not raise any events.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="startObject" class="tsd-anchor"></a><h3 class="tsd-anchor-link"> start<wbr/>Object<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a><a href="#startObject" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Gets or sets the <a href="GraphObject.html">GraphObject</a> at which <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> should start its search.
The default value is null.
Setting this property does not raise any events.</p>
<div><p>If you want to explicitly start a new user mouse-gesture to draw a new link
from a given <a href="GraphObject.html">GraphObject</a> that may be a "port" object or may be within
the visual tree of a "port" object, set this property to that object
to let <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> find the real "port" object.
Then start and activate this tool:</p>
<pre><code class="language-js"><span class="hl-2"> </span><span class="hl-1">var</span><span class="hl-2"> </span><span class="hl-4">tool</span><span class="hl-2"> = </span><span class="hl-4">myDiagram</span><span class="hl-2">.</span><span class="hl-4">toolManager</span><span class="hl-2">.</span><span class="hl-4">linkingTool</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">tool</span><span class="hl-2">.</span><span class="hl-4">startObject</span><span class="hl-2"> = ...;</span><br/><span class="hl-2"> </span><span class="hl-4">myDiagram</span><span class="hl-2">.</span><span class="hl-4">currentTool</span><span class="hl-2"> = </span><span class="hl-4">tool</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">tool</span><span class="hl-2">.</span><span class="hl-5">doActivate</span><span class="hl-2">();</span>
</code></pre>
</div></div></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a id="canStart" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOverride">Override</span> can<wbr/>Start<a href="#canStart" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">can<wbr/>Start<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>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 <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> has returned a valid port
or when <a href="LinkingTool.html#startObject">startObject</a> is a valid port.</p>
<div><p>This method may be overridden, but we recommend that you call this base method.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div></div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a id="doActivate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOverride">Override</span> do<wbr/>Activate<a href="#doActivate" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">do<wbr/>Activate<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Start the linking operation.</p>
<div><p>This calls <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> to find the port from which to start drawing a new link.
If the <a href="LinkingTool.html#startObject">startObject</a> is already set, it uses that object to find the starting port.
If it is not set, it looks for a linkable port at the <a href="Diagram.html#firstInput">Diagram.firstInput</a> point.
If it finds one, it remembers it as the starting port, otherwise it stops this tool.</p>
<p>It then starts a transaction, captures the mouse, and changes the cursor.
Next it initializes and adds the <a href="LinkingBaseTool.html#temporaryFromNode">LinkingBaseTool.temporaryFromNode</a>,
<a href="LinkingBaseTool.html#temporaryToNode">LinkingBaseTool.temporaryToNode</a>, and <a href="LinkingBaseTool.html#temporaryLink">LinkingBaseTool.temporaryLink</a> to the diagram.
The temporary nodes that are positioned and sized to be like the real <a href="LinkingBaseTool.html#originalFromPort">LinkingBaseTool.originalFromPort</a>
and <a href="LinkingBaseTool.html#originalToPort">LinkingBaseTool.originalToPort</a> ports.
The temporary link connects the two temporary ports, of course.</p>
<p>This method may be overridden, but we recommend that you call this base method.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a id="doDeactivate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOverride">Override</span> do<wbr/>Deactivate<a href="#doDeactivate" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">do<wbr/>Deactivate<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Finishing the linking operation stops the transaction, releases the mouse, and resets the cursor.</p>
<div><p>This method may be overridden, but we recommend that you call this base method.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a id="doMouseUp" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOverride">Override</span> do<wbr/>Mouse<wbr/>Up<a href="#doMouseUp" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">do<wbr/>Mouse<wbr/>Up<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>A mouse-up ends the linking operation; if there is a valid <a href="LinkingBaseTool.html#targetPort">targetPort</a> nearby,
this adds a new <a href="Link.html">Link</a> by calling <a href="LinkingTool.html#insertLink">insertLink</a>.</p>
<div><p>If there is a new link, it is selected and the "LinkDrawn" <a href="DiagramEvent.html">DiagramEvent</a> is raised
with the new link as the <a href="DiagramEvent.html#subject">DiagramEvent.subject</a>.
If there is no new link, this calls <a href="LinkingTool.html#doNoLink">doNoLink</a>.
In any case this stops the tool.</p>
<p>This method also raises the "ChangingSelection" and "ChangedSelection" diagram events.
Changes are performed in a "Linking" transaction, but the "ChangedSelection" event is raised outside the transaction.</p>
<p>This method may be overridden, but we recommend that you call this base method.
It is usually easier to override <a href="LinkingTool.html#insertLink">insertLink</a> or just set <a href="LinkingTool.html#archetypeLinkData">archetypeLinkData</a>.
It is also common to implement a "LinkDrawn" <a href="DiagramEvent.html">DiagramEvent</a> listener on the <a href="Diagram.html">Diagram</a>.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="doNoLink" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagVirtual">Virtual</span> do<wbr/>No<wbr/>Link<a href="#doNoLink" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">do<wbr/>No<wbr/>Link<span class="tsd-signature-symbol">(</span>fromnode<span class="tsd-signature-symbol">: </span><a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a>, fromport<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a>, tonode<span class="tsd-signature-symbol">: </span><a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a>, toport<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>This method is called upon a mouse up when no new link is drawn,
either because no valid <a href="LinkingBaseTool.html#targetPort">LinkingBaseTool.targetPort</a> was found or because
<a href="LinkingTool.html#insertLink">insertLink</a> returned null.</p>
<div><p>This method may be overridden. By default this method does nothing.
If you want to successfully perform any side-effects, you will need to set <a href="Tool.html#transactionResult">Tool.transactionResult</a> to a string;
otherwise this tool's transaction will be rolled-back.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</p>
</div><dl class="tsd-comment-tags"><dt class="">since</dt><dd><p>1.7</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>fromnode: <a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a></h5></li><li><h5>fromport: <a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></h5><div class="tsd-comment tsd-typography">
<p>the from-port, or null to use the node itself</p>
</div></li><li><h5>tonode: <a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a></h5></li><li><h5>toport: <a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></h5><div class="tsd-comment tsd-typography">
<p>the to-port, or null to use the node itself</p>
</div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="findLinkablePort" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagVirtual">Virtual</span> find<wbr/>Linkable<wbr/>Port<a href="#findLinkablePort" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">find<wbr/>Linkable<wbr/>Port<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Return the <a href="GraphObject.html">GraphObject</a> at the mouse-down point,
if it is part of a node and if it is valid to link with it.</p>
<div><p>This starts looking for a port at the <a href="LinkingTool.html#startObject">startObject</a> if it is non-null,
otherwise it looks for an object at the <a href="Diagram.html#firstInput">Diagram.firstInput</a>'s <a href="InputEvent.html#documentPoint">InputEvent.documentPoint</a>.
If it finds no object, or if the object it finds is not in a node, this method returns null.
If it does find a port, it should set <a href="LinkingBaseTool.html#isForwards">isForwards</a> to declare which direction the new link is being drawn.</p>
<p>This method may be overridden, but we recommend that you call this base method.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></h4><div><p>If the <a href="LinkingTool.html#direction">direction</a> is <a href="LinkingTool.html#static-Either">LinkingTool.Either</a> or <a href="LinkingTool.html#static-ForwardsOnly">LinkingTool.ForwardsOnly</a>,
this checks the element and its parent <a href="Node.html">Node</a> by calling <a href="LinkingBaseTool.html#isValidFrom">LinkingBaseTool.isValidFrom</a>.
If the <a href="LinkingTool.html#direction">direction</a> is <a href="LinkingTool.html#static-Either">LinkingTool.Either</a> or <a href="LinkingTool.html#static-BackwardsOnly">LinkingTool.BackwardsOnly</a>,
this checks the element and its parent <a href="Node.html">Node</a> by calling <a href="LinkingBaseTool.html#isValidTo">LinkingBaseTool.isValidTo</a>.
In either case finding a matching port will return that port and set <a href="LinkingBaseTool.html#isForwards">LinkingBaseTool.isForwards</a> appropriately.
Otherwise this will return null.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="insertLink" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagVirtual">Virtual</span> insert<wbr/>Link<a href="#insertLink" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">insert<wbr/>Link<span class="tsd-signature-symbol">(</span>fromnode<span class="tsd-signature-symbol">: </span><a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a>, fromport<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a>, tonode<span class="tsd-signature-symbol">: </span><a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a>, toport<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Link.html" class="tsd-signature-type" data-tsd-kind="Class">Link</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography">
<p>Make a copy of the <a href="LinkingTool.html#archetypeLinkData">archetypeLinkData</a>, set its node and port properties, and add it to the <a href="GraphLinksModel.html">GraphLinksModel</a>.
If the model is a <a href="TreeModel.html">TreeModel</a>, set the parent key of the child's node data object.</p>
<div><p>For GraphLinksModels, if <a href="LinkingTool.html#archetypeLabelNodeData">archetypeLabelNodeData</a> is non-null, this method also adds that node data as an initial label node
for the new link data.</p>
<p>For TreeModels, if <a href="Diagram.html#isTreePathToChildren">Diagram.isTreePathToChildren</a> is false, the roles of the <em>fromnode</em> and <em>tonode</em> arguments are exchanged.</p>
<p>This method may be overridden, but we recommend that you call this base method.
Usually though it is easiest to just set <a href="LinkingTool.html#archetypeLinkData">archetypeLinkData</a> to control what kind of link is created.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</p>
</div><dl class="tsd-comment-tags"><dt class="">see</dt><dd><p><a href="LinkingTool.html#doNoLink">doNoLink</a></p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>fromnode: <a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a></h5></li><li><h5>fromport: <a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></h5><div class="tsd-comment tsd-typography">
<p>the from-port, or null to use the node itself</p>
</div></li><li><h5>tonode: <a href="Node.html" class="tsd-signature-type" data-tsd-kind="Class">Node</a></h5></li><li><h5>toport: <a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></h5><div class="tsd-comment tsd-typography">
<p>the to-port, or null to use the node itself</p>
</div></li></ul><h4 class="tsd-returns-title">Returns <a href="Link.html" class="tsd-signature-type" data-tsd-kind="Class">Link</a></h4><div><p>the newly created Link, or null if it failed.</p>
</div></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constants</h2><section class="tsd-panel tsd-member tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a id="static-BackwardsOnly" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> Backwards<wbr/>Only<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span><a href="#static-BackwardsOnly" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-comment tsd-typography">
<p>This value for <a href="LinkingTool.html#direction">LinkingTool.direction</a> indicates that users may draw new links backwards only
(i.e. from "to" node to "from" node).</p>
</div></section><section class="tsd-panel tsd-member tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a id="static-Either" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> Either<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span><a href="#static-Either" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4