UNPKG

sgojs

Version:

Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams

667 lines (666 loc) 42.7 kB
<!doctype html> <html class="default no-js"> <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/css/main.css"> <script async src="../assets/js/search.js" id="search-script"></script> </head> <body> <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 font-bold text-2xl lg:text-4xl rounded-lg hover:bg-nwoods-secondary" href="../../index.html"> <h1 class="mb-0 p-1">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" onclick="getOutboundLink('https://www.nwoods.com/contact.html', 'contact');">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" onclick="getOutboundLink('https://www.nwoods.com/sales/index.html', 'buy');">Buy</a></li> </ul> </div> </div> <hr class="border-b border-gray-600 opacity-50 my-0 py-0" /> </nav> <div class="tsd 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-index="../assets/js/search.json" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </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> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd tsd-page-title"> <div class="w-full max-w-screen-xl mx-auto px-2"> <div class="top-copyright"> <b>GoJS</b>&reg; Diagramming Components<br/>version 2.1.47<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a> </div> <div> <h1>Class LinkingTool</h1> </div> </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> <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 &quot;port&quot; 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 &quot;LinkDrawn&quot; <a href="DiagramEvent.html">DiagramEvent</a> and a &quot;Linking&quot; 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 &quot;port&quot; or may be within the visual tree of a &quot;port&quot;, set the <a href="LinkingTool.html#startObject">startObject</a> property to let <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> find the real &quot;port&quot; element. Then start and activate this tool:</p> <pre><code class="language-js"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">myDiagram</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">toolManager</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">linkingTool</span><span style="color: #D4D4D4">;</span> <span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">startObject</span><span style="color: #D4D4D4"> = ...;</span> <span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">myDiagram</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">currentTool</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4">;</span> <span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">doActivate</span><span style="color: #D4D4D4">();</span> </code></pre> </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>NoLink</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-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <a name="constructor" class="tsd-anchor"></a> <h3> constructor </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> <p>The <a href="Tool.html#name">Tool.name</a> of this tool is &quot;Linking&quot;.</p> </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 name="archetypeLabelNodeData" class="tsd-anchor"></a> <h3> 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> </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> <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> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="archetypeLinkData" class="tsd-anchor"></a> <h3> 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> </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> <p>The copied link data&#39;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&#39;s data&#39;s key values. If the ports have <a href="GraphObject.html#portId">GraphObject.portId</a> values that are not null, the link data&#39;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> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="direction" class="tsd-anchor"></a> <h3> direction <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </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 name="startObject" class="tsd-anchor"></a> <h3> start<wbr>Object <span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</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> <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 &quot;port&quot; object or may be within the visual tree of a &quot;port&quot; object, set this property to that object to let <a href="LinkingTool.html#findLinkablePort">findLinkablePort</a> find the real &quot;port&quot; object. Then start and activate this tool:</p> <pre><code class="language-js"><span style="color: #D4D4D4"> </span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">myDiagram</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">toolManager</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">linkingTool</span><span style="color: #D4D4D4">;</span> <span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">startObject</span><span style="color: #D4D4D4"> = ...;</span> <span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">myDiagram</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">currentTool</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4">;</span> <span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tool</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">doActivate</span><span style="color: #D4D4D4">();</span> </code></pre> </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 name="canStart" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> can<wbr>Start </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> <p>This method may be overridden, but we recommend that you call this base method.</p> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"> <a name="doActivate" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> do<wbr>Activate </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> <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> <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 name="doDeactivate" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> do<wbr>Deactivate </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> <p>This method may be overridden, but we recommend that you call this base method.</p> </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 name="doMouseUp" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> do<wbr>Mouse<wbr>Up </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> <p>If there is a new link, it is selected and the &quot;LinkDrawn&quot; <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 &quot;ChangingSelection&quot; and &quot;ChangedSelection&quot; diagram events. Changes are performed in a &quot;Linking&quot; transaction, but the &quot;ChangedSelection&quot; 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 &quot;LinkDrawn&quot; <a href="DiagramEvent.html">DiagramEvent</a> listener on the <a href="Diagram.html">Diagram</a>.</p> </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 name="doNoLink" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> do<wbr>NoLink </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">do<wbr>NoLink<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> <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&#39;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> <dl class="tsd-comment-tags"> <dt>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 name="findLinkablePort" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> find<wbr>Linkable<wbr>Port </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> <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>&#39;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.</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> <h4 class="tsd-returns-title">Returns <a href="GraphObject.html" class="tsd-signature-type" data-tsd-kind="Class">GraphObject</a></h4> <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> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="insertLink" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> insert<wbr>Link </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&#39;s node data object.</p> <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> <dl class="tsd-comment-tags"> <dt>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> <p>the newly created Link, or null if it failed.</p> </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 name="static-BackwardsOnly" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> Backwards<wbr>Only <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </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 &quot;to&quot; node to &quot;from&quot; node).</p> </div> </section> <section class="tsd-panel tsd-member tsd-kind-constant tsd-parent-kind-class tsd-is-static"> <a name="static-Either" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> Either <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </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 in either direction.</p> </div> </section> <section class="tsd-panel tsd-member tsd-kind-constant tsd-parent-kind-class tsd-is-static"> <a name="static-ForwardsOnly" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> Forwards<wbr>Only <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </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 forwards only (i.e. from &quot;from&quot; node to &quot;to&quot; node).</p> </div> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class=" "> <a href="../index.html">GoJS <wbr>Class <wbr>Index</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> </ul> <ul class="current"> <li class="current tsd-kind-class"> <a href="LinkingTool.html" class="tsd-kind-icon">Linking<wbr>Tool</a> <ul> <li class=" tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <a href="LinkingTool.html#constructor" class="tsd-kind-icon">constructor</a> </li> <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> <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>NoLink</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> <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> </li> </ul> <ul class="after-current"> </ul> </nav> </div> </div> </div> <div class="tsd w-full max-w-screen-xl mx-auto px-2"> <div class="bottom-copyright">Copyright &copy; 1998-2021 by Northwoods Software Corporation.</div> </div> <div class="overlay"></div> <script src="../assets/js/main.js"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-1506307-5"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-1506307-5'); var getOutboundLink = function(url, label) { gtag('event', 'click', { 'event_category': 'outbound', 'event_label': label, 'transport_type': 'beacon' }); } // topnav var topButton = document.getElementById("topnavButton"); var topnavList = document.getElementById("topnavList"); topButton.addEventListener("click", function() { this.classList.toggle("active"); topnavList.classList.toggle("hidden"); document.getElementById("topnavOpen").classList.toggle("hidden"); document.getElementById("topnavClosed").classList.toggle("hidden"); }); </script> </body> </html>