UNPKG

gojs

Version:

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

663 lines (662 loc) 39.9 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>ContextMenuTool | GoJS API</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../../assets/css/bootstrap.min.css"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <!-- non-fixed navbar --> <nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top"> <div class="container-fluid"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#navbar"> <a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> </div> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="../../index.html">Home</a></li> <li><a href="../../learn/index.html">Learn</a></li> <li><a href="../../samples/index.html">Samples</a></li> <li><a href="../../intro/index.html">Intro</a></li> <li><a href="../../api/index.html" target="api">API</a></li> <li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li> <li><a href="../../download.html">Download</a></li> <li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li> <li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li> <li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li> <li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="tsd-page-header"> <div class="tsd-page-toolbar"> <div class="container-fluid plr15"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" 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-page-title"> <div class="container-fluid plr15"> <div class="top-copyright"> <!--<b>GoJS</b>&reg; Diagramming Components<br/>version &lt;br/&gt;version 2.1.18 for TypeScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a>--> <b>GoJS</b>&reg; Diagramming Components<br/>version 2.1.18<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a> </div> <div> <h1>Class ContextMenuTool</h1> </div> </div> </div> </div> </header> <div class="container-fluid container-main plr15"> <div class="row"> <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">Tool</a> <ul class="tsd-hierarchy"> <li> <span class="target">ContextMenuTool</span> </li> </ul> </li> </ul> </section> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <p>The ContextMenuTool is used to create and show a context menu. It automatically disables any browser context menu.</p> <p>Define context menus on individual <a href="GraphObject.html">GraphObject</a>s by setting <a href="GraphObject.html#contextMenu">GraphObject.contextMenu</a>. Define a context menu for the diagram background by setting <a href="Diagram.html#contextMenu">Diagram.contextMenu</a>.</p> <p>This tool is a standard mouse-down tool, the <a href="ToolManager.html#contextMenuTool">ToolManager.contextMenuTool</a>.</p> <p>This tool does not utilize any tool handles. This tool does not modify the model or conduct any transaction, although any code invoked by context menu commands might do so.</p> <p>There are examples of customizing this tool in the <a href="../../samples/customContextMenu.html">Custom Context Menu</a> and <a href="../../samples/htmlLightBoxContextMenu.html">HTML LightBox Context Menu</a> samples.</p> <p>If you want to programmatically show a context menu for a particular GraphObject or for the whole diagram, call <a href="CommandHandler.html#showContextMenu">CommandHandler.showContextMenu</a>. That command method is also invoked by the Menu key on the keyboard.</p> <p>Normally this shows a context menu (if available) on a right-mouse-up event. If you want it to happen on a right-mouse-down event, you&#39;ll need to move this tool from the <a href="ToolManager.html#mouseUpTools">ToolManager.mouseUpTools</a> list to the <a href="ToolManager.html#mouseDownTools">ToolManager.mouseDownTools</a> list:</p> <pre><code class="hljs js">myDiagram.toolManager.mouseDownTools.add(myDiagram.toolManager.replaceTool(<span class="hljs-string">"ContextMenu"</span>, <span class="hljs-literal">null</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"><a href="ContextMenuTool.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="ContextMenuTool.html#currentContextMenu" class="tsd-kind-icon">current<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="ContextMenuTool.html#currentObject" class="tsd-kind-icon">current<wbr>Object</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="ContextMenuTool.html#defaultTouchContextMenu" class="tsd-kind-icon">default<wbr>Touch<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="ContextMenuTool.html#mouseDownPoint" class="tsd-kind-icon">mouse<wbr>Down<wbr>Point</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"><a href="ContextMenuTool.html#canStart" class="tsd-kind-icon">can<wbr>Start</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#doActivate" class="tsd-kind-icon">do<wbr>Activate</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#doMouseDown" class="tsd-kind-icon">do<wbr>Mouse<wbr>Down</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#doMouseMove" class="tsd-kind-icon">do<wbr>Mouse<wbr>Move</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#doMouseUp" class="tsd-kind-icon">do<wbr>Mouse<wbr>Up</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#findObjectWithContextMenu" class="tsd-kind-icon">find<wbr>Object<wbr>With<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#hideContextMenu" class="tsd-kind-icon">hide<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#hideDefaultContextMenu" class="tsd-kind-icon">hide<wbr>Default<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#positionContextMenu" class="tsd-kind-icon">position<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#showContextMenu" class="tsd-kind-icon">show<wbr>Context<wbr>Menu</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="ContextMenuTool.html#showDefaultContextMenu" class="tsd-kind-icon">show<wbr>Default<wbr>Context<wbr>Menu</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"> <a name="constructor" class="tsd-anchor"></a> <h3> constructor </h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">new <wbr>Context<wbr>Menu<wbr>Tool<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ContextMenuTool.html" class="tsd-signature-type">ContextMenuTool</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#contextMenuTool">ToolManager.contextMenuTool</a>, which you can modify.</p> <p>The <a href="Tool.html#name">Tool.name</a> of this tool is &quot;ContextMenu&quot;.</p> </div> <h4 class="tsd-returns-title">Returns <a href="ContextMenuTool.html" class="tsd-signature-type">ContextMenuTool</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="currentContextMenu" class="tsd-anchor"></a> <h3> current<wbr>Context<wbr>Menu <span class="tsd-signature-symbol">: </span><a href="Adornment.html" class="tsd-signature-type">Adornment</a><span class="tsd-signature-symbol"> | </span><a href="HTMLInfo.html" class="tsd-signature-type">HTMLInfo</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the currently showing context menu, or null if there is none. This is typically only set in <a href="ContextMenuTool.html#showContextMenu">showContextMenu</a> and not by the user. It is also typically set to null in <a href="ContextMenuTool.html#hideContextMenu">hideContextMenu</a>.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="currentObject" class="tsd-anchor"></a> <h3> current<wbr>Object <span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </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> found at the mouse point that has a context menu. This property remembers the result returned by <a href="ContextMenuTool.html#findObjectWithContextMenu">findObjectWithContextMenu</a> if it is a GraphObject. This value is passed to <a href="ContextMenuTool.html#showContextMenu">showContextMenu</a> as the second argument. The value will be null if the context menu is for the diagram rather than for a particular GraphObject.</p> <dl class="tsd-comment-tags"> <dt>since</dt> <dd><p>1.4</p> </dd> </dl> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="defaultTouchContextMenu" class="tsd-anchor"></a> <h3> default<wbr>Touch<wbr>Context<wbr>Menu <span class="tsd-signature-symbol">: </span><a href="Adornment.html" class="tsd-signature-type">Adornment</a><span class="tsd-signature-symbol"> | </span><a href="HTMLInfo.html" class="tsd-signature-type">HTMLInfo</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the HTMLInfo or Adornment that acts as the default touch context menu. On touch devices, this context menu will appear even there is no context menu defined.</p> <p>You can disable this functionality by setting this property to null.</p> <p>By default shows a set of HTML elements acting as a context menu.</p> <dl class="tsd-comment-tags"> <dt>since</dt> <dd><p>1.7</p> </dd> </dl> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"> <a name="mouseDownPoint" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagReadOnly">Read-only</span> mouse<wbr>Down<wbr>Point <span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This read-only property returns the original mouse-down point in document coordinates.</p> </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"> <a name="canStart" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> <span class="tsd-flag ts-flagOverride">Override</span> can<wbr>Start </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <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>Return true if it&#39;s a mouse right click that hasn&#39;t moved <a href="Tool.html#isBeyondDragSize">Tool.isBeyondDragSize</a> and that is on a <a href="GraphObject.html">GraphObject</a> with a <a href="GraphObject.html#contextMenu">GraphObject.contextMenu</a>. This is also true if the mouse right click is in the diagram background and the diagram&#39;s <a href="Diagram.html#contextMenu">Diagram.contextMenu</a> is non-null.</p> <p>On touch devices, a special default context menu will appear even if no object with a context menu is found.</p> <p>This method may be overridden. 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 <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <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"> <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>Do nothing, activation is special and relies on doMouseUp</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="doMouseDown" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> do<wbr>Mouse<wbr>Down </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">do<wbr>Mouse<wbr>Down<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>Activate this but also execute the normal behavior that would happen on a mouse-up if this tool is in the <a href="ToolManager.html#mouseDownTools">ToolManager.mouseDownTools</a> list. Perform <a href="ActionTool.html#doMouseDown">ActionTool.doMouseDown</a> if a ContextMenuButton was hit.</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="doMouseMove" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> do<wbr>Mouse<wbr>Move </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">do<wbr>Mouse<wbr>Move<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>Handle mouse-enter, mouse-over, and mouse-leave events, as well as tooltips.</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="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"> <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>If there is something found by <a href="ContextMenuTool.html#findObjectWithContextMenu">findObjectWithContextMenu</a>, call <a href="ContextMenuTool.html#showContextMenu">showContextMenu</a> with that object&#39;s <a href="GraphObject.html#contextMenu">GraphObject.contextMenu</a> or the <a href="Diagram.html#contextMenu">Diagram.contextMenu</a>.</p> <p>Once a context menu is being shown, if a click occurs on a part of the context menu, call <a href="Tool.html#standardMouseClick">Tool.standardMouseClick</a>. Otherwise if the click occurs elsewhere, just stop this tool. Unlike most tools, the first mouse-up should not stop this tool.</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="findObjectWithContextMenu" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> find<wbr>Object<wbr>With<wbr>Context<wbr>Menu </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">find<wbr>Object<wbr>With<wbr>Context<wbr>Menu<span class="tsd-signature-symbol">(</span>obj<span class="tsd-signature-symbol">?: </span><a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><a href="Diagram.html" class="tsd-signature-type">Diagram</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><a href="Diagram.html" class="tsd-signature-type">Diagram</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Find a <a href="GraphObject.html">GraphObject</a> at the current mouse point with a <a href="GraphObject.html#contextMenu">GraphObject.contextMenu</a>, or return the <a href="Diagram.html">Diagram</a> if there is a <a href="Diagram.html#contextMenu">Diagram.contextMenu</a>.</p> <p>This method may be overridden. 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-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> obj: <a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><a href="Diagram.html" class="tsd-signature-type">Diagram</a></h5> <div class="tsd-comment tsd-typography"> <p>Optional GraphObject with which to start searching for a context menu. If null, the Diagram will be used. If no argument is specified, this method will look for an object at the current mouse point.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="GraphObject.html" class="tsd-signature-type">GraphObject</a> <span class="tsd-signature-symbol"> | </span> <a href="Diagram.html" class="tsd-signature-type">Diagram</a> <span class="tsd-signature-symbol"> | </span> <span class="tsd-signature-type">null</span> </h4> <p>something with a <code>contextMenu</code>, or null if nothing can be found with a context menu at the current mouse point.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="hideContextMenu" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> hide<wbr>Context<wbr>Menu </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">hide<wbr>Context<wbr>Menu<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>Hide any context menu.</p> <p>This method may be overridden. 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 <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="hideDefaultContextMenu" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> hide<wbr>Default<wbr>Context<wbr>Menu </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">hide<wbr>Default<wbr>Context<wbr>Menu<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>This is the <a href="HTMLInfo.html#hide">HTMLInfo.hide</a> method for the <a href="ContextMenuTool.html#defaultTouchContextMenu">defaultTouchContextMenu</a>.</p> <p>This method may be overridden. 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 <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="positionContextMenu" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> position<wbr>Context<wbr>Menu </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">position<wbr>Context<wbr>Menu<span class="tsd-signature-symbol">(</span>contextmenu<span class="tsd-signature-symbol">: </span><a href="Adornment.html" class="tsd-signature-type">Adornment</a>, obj<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</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>This is called by <a href="ContextMenuTool.html#showContextMenu">showContextMenu</a> to position the context menu within the viewport. It normally goes just below the cursor. But if the mouse is too close to the right edge or the bottom edge of the viewport, it is positioned left and/or above the cursor.</p> <p>This method only operates if the context menu, an <a href="Adornment.html">Adornment</a>, does not have a <a href="Adornment.html#placeholder">Adornment.placeholder</a>. When there is a <a href="Placeholder.html">Placeholder</a> in the context menu, that Adornment is automatically positioned so that the Placeholder is positioned at the adorned object, the second argument to this method.</p> <p>This method may be overridden. 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> <p>If you override this method to position the context menu, the context menu has already been measured but not arranged, so you can use its <a href="GraphObject.html#measuredBounds">GraphObject.measuredBounds</a> width and height but not its <a href="GraphObject.html#actualBounds">GraphObject.actualBounds</a>.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>contextmenu: <a href="Adornment.html" class="tsd-signature-type">Adornment</a></h5> </li> <li> <h5>obj: <a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h5> <div class="tsd-comment tsd-typography"> <p>The <a href="GraphObject.html">GraphObject</a> getting the context menu, or null if the context menu is for the diagram background.</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="showContextMenu" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> show<wbr>Context<wbr>Menu </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">show<wbr>Context<wbr>Menu<span class="tsd-signature-symbol">(</span>contextmenu<span class="tsd-signature-symbol">: </span><a href="Adornment.html" class="tsd-signature-type">Adornment</a><span class="tsd-signature-symbol"> | </span><a href="HTMLInfo.html" class="tsd-signature-type">HTMLInfo</a>, obj<span class="tsd-signature-symbol">: </span><a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</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>Show an <a href="Adornment.html">Adornment</a> or <a href="HTMLInfo.html">HTMLInfo</a> as a context menu.</p> <p>This method is called by the context click (<a href="Tool.html#doMouseDown">Tool.doMouseDown</a>) and <a href="CommandHandler.html#showContextMenu">CommandHandler.showContextMenu</a>. If you want to programmatically show a context menu for a particular GraphObject or for the whole diagram, do not call this method, which only does one small piece of the process of bringing up a context menu. Instead call <a href="CommandHandler.html#showContextMenu">CommandHandler.showContextMenu</a>, which will start this tool and eventually call this method and handle additional input events.</p> <p>For <a href="Adornment.html">Adornment</a> context menus: If the object&#39;s containing <a href="Part.html">Part</a> is data-bound, this sets the contextmenu&#39;s <code>Part.data</code> to the same value. The <a href="Adornment.html#adornedObject">Adornment.adornedObject</a> property is set to the <a href="GraphObject.html">GraphObject</a> for which the menu is being shown.</p> <p>This method sets the <a href="ContextMenuTool.html#currentContextMenu">currentContextMenu</a>.</p> <p>This method may be overridden. 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-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>contextmenu: <a href="Adornment.html" class="tsd-signature-type">Adornment</a><span class="tsd-signature-symbol"> | </span><a href="HTMLInfo.html" class="tsd-signature-type">HTMLInfo</a></h5> </li> <li> <h5>obj: <a href="GraphObject.html" class="tsd-signature-type">GraphObject</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h5> <div class="tsd-comment tsd-typography"> <p>the <a href="GraphObject.html">GraphObject</a> for which the context menu is being shown; this is null if the contextmenu is being shown for the diagram background.</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="showDefaultContextMenu" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> show<wbr>Default<wbr>Context<wbr>Menu </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">show<wbr>Default<wbr>Context<wbr>Menu<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>This is the <a href="HTMLInfo.html#show">HTMLInfo.show</a> method for the <a href="ContextMenuTool.html#defaultTouchContextMenu">defaultTouchContextMenu</a>.</p> <p>If the object&#39;s containing <a href="Part.html">Part</a> is data-bound, set the contextmenu&#39;s <code>Part.data</code> to the same value. The <a href="Adornment.html#adornedObject">Adornment.adornedObject</a> property is set to the <a href="GraphObject.html">GraphObject</a> for which the menu is being shown.</p> <p>The menu carries some default CSS styling and uses the following CSS classes:</p> <ul> <li><code>goCXforeground</code> for the DIV containing the buttons</li> <li><code>goCXbackground</code> for the darker DIV behind the context menu</li> <li><code>goCXul</code> for the HTML <code>ul</code> items</li> <li><code>goCXli</code> for the HTML <code>li</code> tag items</li> <li><code>goCXa</code> for the HTML <code>a</code> tag items</li> </ul> <p>This method may be overridden. 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 <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="../index.html"><em>GoJS <wbr>Class <wbr>Index</em></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="ContextMenuTool.html" class="tsd-kind-icon">Context<wbr>Menu<wbr>Tool</a> <ul> <li class=" tsd-kind-constructor tsd-parent-kind-class"> <a href="ContextMenuTool.html#constructor" class="tsd-kind-icon">constructor</a> </li> <li class=" tsd-kind-accessor tsd-parent-kind-class"> <a href="ContextMenuTool.html#currentContextMenu" class="tsd-kind-icon">current<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-accessor tsd-parent-kind-class"> <a href="ContextMenuTool.html#currentObject" class="tsd-kind-icon">current<wbr>Object</a> </li> <li class=" tsd-kind-accessor tsd-parent-kind-class"> <a href="ContextMenuTool.html#defaultTouchContextMenu" class="tsd-kind-icon">default<wbr>Touch<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-get-signature tsd-parent-kind-class"> <a href="ContextMenuTool.html#mouseDownPoint" class="tsd-kind-icon">mouse<wbr>Down<wbr>Point</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#canStart" class="tsd-kind-icon">can<wbr>Start</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#doActivate" class="tsd-kind-icon">do<wbr>Activate</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#doMouseDown" class="tsd-kind-icon">do<wbr>Mouse<wbr>Down</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#doMouseMove" class="tsd-kind-icon">do<wbr>Mouse<wbr>Move</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#doMouseUp" class="tsd-kind-icon">do<wbr>Mouse<wbr>Up</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#findObjectWithContextMenu" class="tsd-kind-icon">find<wbr>Object<wbr>With<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#hideContextMenu" class="tsd-kind-icon">hide<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#hideDefaultContextMenu" class="tsd-kind-icon">hide<wbr>Default<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#positionContextMenu" class="tsd-kind-icon">position<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#showContextMenu" class="tsd-kind-icon">show<wbr>Context<wbr>Menu</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="ContextMenuTool.html#showDefaultContextMenu" class="tsd-kind-icon">show<wbr>Default<wbr>Context<wbr>Menu</a> </li> </ul> </li> </ul> <ul class="after-current"> </ul> </nav> </div> </div> </div> <div class="container-fluid bottom-copyright plr15"> Copyright &copy; 1998-2020 by Northwoods Software Corporation. </div> <div class="overlay"></div> <script src="../assets/js/main.js"></script> <script src="../../assets/js/api.js"></script> <script src="../../assets/js/bootstrap.min.js"></script> <script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-1506307-5', 'auto'); ga('send', 'pageview'); </script> </body> </html>