UNPKG

markgojs

Version:

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

1,563 lines (545 loc) 175 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>GoJS&reg; CommandHandler Class</title> <script src="../../assets/js/jquery.min.js"></script> <script src="../../assets/js/bootstrap.min.js"></script> <script src="../../assets/js/highlight.js"></script> <script src="../../assets/js/api.js"></script> <script src="../../assets/js/fuse.min.js"></script> <link href="../../assets/css/bootstrap.min.css" rel="stylesheet" > <!-- custom CSS after bootstrap --> <link href="../../assets/css/main.css" rel="stylesheet" type="text/css"/> <link href="../../assets/css/api.css" rel="stylesheet" type="text/css"/> <!--<link rel="stylesheet" href="../../assets/css/api.css" type="text/css" media="all" />--> <link rel="stylesheet" href="../../assets/css/highlight.css" type="text/css" media="all" /> </head> <body> <!-- 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">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="container-fluid"> <!-- ============================== classes index ============================ --> <div id="navindex" class="col-md-2"> <!-- begin publish.classesIndex --> <!-- <div><a href="../index.html">GoJS Class Index</a></div> --> <div class="sidebar-nav"> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#DiagramNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#DiagramNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Diagram Classes</span> </div> </div> <div id="DiagramNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Adornment.html" class="linkConstructor">Adornment</a></li> <li><a href="../symbols/AnimationManager.html" class="linkConstructor">AnimationManager</a></li> <li><a href="../symbols/CommandHandler.html" class="linkConstructor">CommandHandler</a></li> <li><a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a></li> <li><a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a></li> <li><a href="../symbols/GraphObject.html" class="linkConstructor">GraphObject</a></li> <li><a href="../symbols/Group.html" class="linkConstructor">Group</a></li> <li><a href="../symbols/InputEvent.html" class="linkConstructor">InputEvent</a></li> <li><a href="../symbols/Layer.html" class="linkConstructor">Layer</a></li> <li><a href="../symbols/Link.html" class="linkConstructor">Link</a></li> <li><a href="../symbols/Node.html" class="linkConstructor">Node</a></li> <li><a href="../symbols/Overview.html" class="linkConstructor">Overview</a></li> <li><a href="../symbols/Palette.html" class="linkConstructor">Palette</a></li> <li><a href="../symbols/Panel.html" class="linkConstructor">Panel</a></li> <li><a href="../symbols/Part.html" class="linkConstructor">Part</a></li> <li><a href="../symbols/Picture.html" class="linkConstructor">Picture</a></li> <li><a href="../symbols/Placeholder.html" class="linkConstructor">Placeholder</a></li> <li><a href="../symbols/RowColumnDefinition.html" class="linkConstructor">RowColumnDefinition</a></li> <li><a href="../symbols/Shape.html" class="linkConstructor">Shape</a></li> <li><a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#GeometryNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#GeometryNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Geometry Classes</span> </div> </div> <div id="GeometryNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Brush.html" class="linkConstructor">Brush</a></li> <li><a href="../symbols/Geometry.html" class="linkConstructor">Geometry</a></li> <li><a href="../symbols/Margin.html" class="linkConstructor">Margin</a></li> <li><a href="../symbols/PathFigure.html" class="linkConstructor">PathFigure</a></li> <li><a href="../symbols/PathSegment.html" class="linkConstructor">PathSegment</a></li> <li><a href="../symbols/Point.html" class="linkConstructor">Point</a></li> <li><a href="../symbols/Rect.html" class="linkConstructor">Rect</a></li> <li><a href="../symbols/Size.html" class="linkConstructor">Size</a></li> <li><a href="../symbols/Spot.html" class="linkConstructor">Spot</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#ModelNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#ModelNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Model Classes</span> </div> </div> <div id="ModelNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Binding.html" class="linkConstructor">Binding</a></li> <li><a href="../symbols/ChangedEvent.html" class="linkConstructor">ChangedEvent</a></li> <li><a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a></li> <li><a href="../symbols/Model.html" class="linkConstructor">Model</a></li> <li><a href="../symbols/Transaction.html" class="linkConstructor">Transaction</a></li> <li><a href="../symbols/TreeModel.html" class="linkConstructor">TreeModel</a></li> <li><a href="../symbols/UndoManager.html" class="linkConstructor">UndoManager</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#LayoutNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#LayoutNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Layout Classes</span> </div> </div> <div id="LayoutNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/CircularLayout.html" class="linkConstructor">CircularLayout</a></li> <li><a href="../symbols/ForceDirectedLayout.html" class="linkConstructor">ForceDirectedLayout</a></li> <li><a href="../symbols/GridLayout.html" class="linkConstructor">GridLayout</a></li> <li><a href="../symbols/LayeredDigraphLayout.html" class="linkConstructor">LayeredDigraphLayout</a></li> <li><a href="../symbols/Layout.html" class="linkConstructor">Layout</a></li> <li><a href="../symbols/LayoutNetwork.html" class="linkConstructor">LayoutNetwork</a></li> <li><a href="../symbols/TreeLayout.html" class="linkConstructor">TreeLayout</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#ToolNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#ToolNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Tool Classes</span> </div> </div> <div id="ToolNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/ActionTool.html" class="linkConstructor">ActionTool</a></li> <li><a href="../symbols/ClickCreatingTool.html" class="linkConstructor">ClickCreatingTool</a></li> <li><a href="../symbols/ClickSelectingTool.html" class="linkConstructor">ClickSelectingTool</a></li> <li><a href="../symbols/ContextMenuTool.html" class="linkConstructor">ContextMenuTool</a></li> <li><a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a></li> <li><a href="../symbols/DragSelectingTool.html" class="linkConstructor">DragSelectingTool</a></li> <li><a href="../symbols/HTMLInfo.html" class="linkConstructor">HTMLInfo</a></li> <li><a href="../symbols/LinkingBaseTool.html" class="linkConstructor">LinkingBaseTool</a></li> <li><a href="../symbols/LinkingTool.html" class="linkConstructor">LinkingTool</a></li> <li><a href="../symbols/LinkReshapingTool.html" class="linkConstructor">LinkReshapingTool</a></li> <li><a href="../symbols/PanningTool.html" class="linkConstructor">PanningTool</a></li> <li><a href="../symbols/RelinkingTool.html" class="linkConstructor">RelinkingTool</a></li> <li><a href="../symbols/ResizingTool.html" class="linkConstructor">ResizingTool</a></li> <li><a href="../symbols/RotatingTool.html" class="linkConstructor">RotatingTool</a></li> <li><a href="../symbols/TextEditingTool.html" class="linkConstructor">TextEditingTool</a></li> <li><a href="../symbols/Tool.html" class="linkConstructor">Tool</a></li> <li><a href="../symbols/ToolManager.html" class="linkConstructor">ToolManager</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#CollectionNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#CollectionNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Collection Classes</span> </div> </div> <div id="CollectionNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Iterable.html" class="linkConstructor">Iterable</a></li> <li><a href="../symbols/Iterator.html" class="linkConstructor">Iterator</a></li> <li><a href="../symbols/List.html" class="linkConstructor">List</a></li> <li><a href="../symbols/Map.html" class="linkConstructor">Map</a></li> <li><a href="../symbols/Set.html" class="linkConstructor">Set</a></li> </ul> </div> </div> </div> <!-- /class="sidebar-nav --> <!-- end publish.classesIndex --> </div> <div id="contentBody" class="col-md-10"> <div class="searchsumm"> <div class="table-wrap"> <div class="table-cell" id="apisearch" data-base="../"> <div class="title">Search API</div> <div class="field"> <label for="search-field" class="search-icon"></label> <input id="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> </div> <div class="table-cell" id="apisumm"> <input type="checkbox" id="showsumms" /> <label class="apisumms" for="showsumms">Show Summaries</label> </div> </div> </div> <!-- ============================== header ================================= --> <div id="header" class="fineprint"> <b>GoJS</b>&reg; Diagramming Components<br/>version 1.8.36 for JavaScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a> </div> <!-- ============================== class title ============================ --> <h2 class="classTitle"> Class CommandHandler </h2> <!-- ============================== class summary ========================== --> <p class="classsummary"> The <a href="../symbols/Diagram.html#commandHandler" class="linkProperty">Diagram.commandHandler</a> implements various commands such as <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">CommandHandler.deleteSelection</a> or <a href="../symbols/CommandHandler.html#redo" class="linkMethod">CommandHandler.redo</a>. The CommandHandler includes keyboard event handling to interpret key presses as commands. <p> CommandHandlers cannot be shared amongst multiple Diagrams. <p> You may define a CommandHandler subclass and override methods. However you must seriously consider calling the base method in order to get its default behavior. There may be situations where not calling the base method may cause subtle bugs, but that depends on the method. Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call a base method. <p> There is an example custom CommandHandler in the extensions directory: <a href="../../extensions/DrawCommandHandler.js">DrawCommandHandler.js</a>, which provides alignment commands and additional behaviors for the arrow keys. <p class="boxread"> For additional discussion, please read the <a href="../../intro/commands.html">Introduction page on Commands</a>. <h3>Keyboard Shortcuts</h3> The CommandHandler implements the following command bindings for keyboard input in <a href="../symbols/CommandHandler.html#doKeyDown" class="linkMethod">doKeyDown</a>: <ul> <li><code>Ctrl-X</code> & <code>Shift-Del</code> invoke <a href="../symbols/CommandHandler.html#cutSelection" class="linkMethod">cutSelection</a></li> <li><code>Ctrl-C</code> & <code>Ctrl-Insert</code> invoke <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a></li> <li><code>Ctrl-V</code> & <code>Shift-Insert</code> invoke <a href="../symbols/CommandHandler.html#pasteSelection" class="linkMethod">pasteSelection</a></li> <li><code>Del</code> & <code>Backspace</code> invoke <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a></li> <li><code>Ctrl-A</code> invokes <a href="../symbols/CommandHandler.html#selectAll" class="linkMethod">selectAll</a></li> <li><code>Ctrl-Z</code> & <code>Alt-Backspace</code> invoke <a href="../symbols/CommandHandler.html#undo" class="linkMethod">undo</a></li> <li><code>Ctrl-Y</code> & <code>Alt-Shift-Backspace</code> invoke <a href="../symbols/CommandHandler.html#redo" class="linkMethod">redo</a></li> <li><code>Up</code> & <code>Down</code> & <code>Left</code> & <code>Right</code> (arrow keys) call <a href="../symbols/Diagram.html#scroll" class="linkMethod">Diagram.scroll</a></li> <li><code>PageUp</code> & <code>PageDown</code> call <a href="../symbols/Diagram.html#scroll" class="linkMethod">Diagram.scroll</a></li> <li><code>Home</code> & <code>End</code> call <a href="../symbols/Diagram.html#scroll" class="linkMethod">Diagram.scroll</a></li> <li><code>Space</code> invokes <a href="../symbols/CommandHandler.html#scrollToPart" class="linkMethod">scrollToPart</a></li> <li><code>Ctrl-- & Keypad--</code> (minus) invoke <a href="../symbols/CommandHandler.html#decreaseZoom" class="linkMethod">decreaseZoom</a></li> <li><code>Ctrl-+ & Keypad-+</code> (plus) invoke <a href="../symbols/CommandHandler.html#increaseZoom" class="linkMethod">increaseZoom</a></li> <li><code>Ctrl-0</code> invokes <a href="../symbols/CommandHandler.html#resetZoom" class="linkMethod">resetZoom</a></li> <li><code>Shift-Z</code> invokes <a href="../symbols/CommandHandler.html#zoomToFit" class="linkMethod">zoomToFit</a>; repeat to return to the original scale and position</li> <li><code>Ctrl-G</code> invokes <a href="../symbols/CommandHandler.html#groupSelection" class="linkMethod">groupSelection</a></li> <li><code>Ctrl-Shift-G</code> invokes <a href="../symbols/CommandHandler.html#ungroupSelection" class="linkMethod">ungroupSelection</a></li> <li><code>F2</code> invokes <a href="../symbols/CommandHandler.html#editTextBlock" class="linkMethod">editTextBlock</a></li> <li><code>Menu Key</code> invokes <a href="../symbols/CommandHandler.html#showContextMenu" class="linkMethod">showContextMenu</a></li> <li><code>Esc</code> invokes <a href="../symbols/CommandHandler.html#stopCommand" class="linkMethod">stopCommand</a></li> </ul> <p> On a Macintosh the Command key is used as the modifier instead of the Control key. </p> <p> On touch devices there is a default context menu that shows many commonly-used commands when you hold a finger down on the diagram. </p> </p> <!-- ============================== constructor summary ==================== --> <h2 id="constructor" class="summaryCaption"> Constructor <span class="nodetails"> Summary</span><span class="details"> Details</span></h2> <div class="table-responsive"> <table class="summaryTable table table-bordered table-condensed" summary="A summary of the constructor documented in the class CommandHandler."> <thead> <tr> <th scope="col" class="name">Name</th> <th scope="col" class="description">Description</th> </tr> </thead> <tbody> <tr> <td class="name" > <div class="name"> CommandHandler() </div> </td> <td class="description"> <div class="description"> <!--newp--><p><p>The constructor produces a CommandHandler with the default key bindings. </div> </td> </tr> </tbody> </table> </div><!-- class="table-responsive">--> <!-- ============================== properties summary ===================== --> <h2 class="summaryCaption">Properties<span class="nodetails"> Summary</span><span class="details"> Details</span></h2> <div class="table-responsive"> <table class="summaryTable table table-bordered table-condensed" summary="A summary of the properties documented in the class CommandHandler."> <thead> <tr> <th scope="col" class="name">Name, Value Type</th> <th scope="col" class="description">Description</th> </tr> </thead> <tbody> <tr id="archetypeGroupData" > <td class="name"> <div class="name"> archetypeGroupData </div> <div class="attributes"> <span class="light">{Object}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets a data object that is copied by <a href="../symbols/CommandHandler.html#groupSelection" class="linkMethod">groupSelection</a> when creating a new Group.<span class="nodetails" id="xproparchetypeGroupData"><a class="morelink" onclick="hst('proparchetypeGroupData')">More...</a></span> <span class="details" id="proparchetypeGroupData"> </span><div class="details" id="dproparchetypeGroupData"><p> The default value is null. If you set this to an Object, be sure that <a href="../symbols/GraphLinksModel.html#isGroupForNodeData" class="linkMethod">GraphLinksModel.isGroupForNodeData</a> is true for that object. Setting this property does not raise any events.</div> </div> </td> </tr> <tr id="copiesConnectedLinks" > <td class="name"> <div class="name"> copiesConnectedLinks </div> <div class="attributes"> <span class="light">{boolean}</span> <span class="since" title="since">1.5</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> should also copy Links that connect with selected Nodes.<span class="nodetails" id="xpropcopiesConnectedLinks"><a class="morelink" onclick="hst('propcopiesConnectedLinks')">More...</a></span> <span class="details" id="propcopiesConnectedLinks"> The default value is true. Setting this property does not raise any events. </span><div class="details" id="dpropcopiesConnectedLinks"><p> The <a href="../symbols/DraggingTool.html#copiesEffectiveCollection" class="linkProperty">DraggingTool.copiesEffectiveCollection</a> property serves a similar role for the <a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a> when the user holds down the control key to modify the drag into a copy operation.</div> </div> </td> </tr> <tr id="copiesGroupKey" > <td class="name"> <div class="name"> copiesGroupKey </div> <div class="attributes"> <span class="light">{boolean}</span> <span class="since" title="since">1.3</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> and <a href="../symbols/CommandHandler.html#copyToClipboard" class="linkMethod">copyToClipboard</a> copy the node data property whose value is the containing group data's key.<span class="nodetails" id="xpropcopiesGroupKey"><a class="morelink" onclick="hst('propcopiesGroupKey')">More...</a></span> <span class="details" id="propcopiesGroupKey"> </span><div class="details" id="dpropcopiesGroupKey"><p> Set this property to true if you want a copy/paste of a node to automatically have the new node be a member of the original group. Caution: this only has an effect if the Diagram's <a href="../symbols/Diagram.html#model" class="linkProperty">Diagram.model</a> is a <a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a>. <p> The default value is false.</div> </div> </td> </tr> <tr id="copiesParentKey" > <td class="name"> <div class="name"> copiesParentKey </div> <div class="attributes"> <span class="light">{boolean}</span> <span class="since" title="since">1.3</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> and <a href="../symbols/CommandHandler.html#copyToClipboard" class="linkMethod">copyToClipboard</a> copy the node data property whose value is the tree-parent node data's key.<span class="nodetails" id="xpropcopiesParentKey"><a class="morelink" onclick="hst('propcopiesParentKey')">More...</a></span> <span class="details" id="propcopiesParentKey"> </span><div class="details" id="dpropcopiesParentKey"><p> Set this property to true if you want a copy/paste of a node to automatically have the new node be a tree-child of the original tree-parent node. Caution: this only has an effect if the Diagram's <a href="../symbols/Diagram.html#model" class="linkProperty">Diagram.model</a> is a <a href="../symbols/TreeModel.html" class="linkConstructor">TreeModel</a>. <p> The default value is false.</div> </div> </td> </tr> <tr id="copiesTree" > <td class="name"> <div class="name"> copiesTree </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> should also copy subtrees.<span class="nodetails" id="xpropcopiesTree"><a class="morelink" onclick="hst('propcopiesTree')">More...</a></span> <span class="details" id="propcopiesTree"> The default value is false. Setting this property does not raise any events. </span><div class="details" id="dpropcopiesTree"><p> The <a href="../symbols/DraggingTool.html#dragsTree" class="linkProperty">DraggingTool.dragsTree</a> property serves a similar role for the <a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a> for both moving and copying operations.</div> </div> </td> </tr> <tr id="defaultScale" > <td class="name"> <div class="name"> defaultScale </div> <div class="attributes"> <span class="light">{number}</span> <span class="since" title="since">1.3</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a> set by <a href="../symbols/CommandHandler.html#resetZoom" class="linkMethod">resetZoom</a>.<span class="nodetails" id="xpropdefaultScale"><a class="morelink" onclick="hst('propdefaultScale')">More...</a></span> <span class="details" id="propdefaultScale"> </span><div class="details" id="dpropdefaultScale"><p> The default value is 1.0. The value must be a number larger than 0. Setting this property does not raise any events.</div> </div> </td> </tr> <tr id="deletesConnectedLinks" > <td class="name"> <div class="name"> deletesConnectedLinks </div> <div class="attributes"> <span class="light">{boolean}</span> <span class="since" title="since">1.6</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a> should also delete links that are connected to nodes that are deleted.<span class="nodetails" id="xpropdeletesConnectedLinks"><a class="morelink" onclick="hst('propdeletesConnectedLinks')">More...</a></span> <span class="details" id="propdeletesConnectedLinks"> The default value is true. Setting this property does not raise any events.</span> </div> </td> </tr> <tr id="deletesTree" > <td class="name"> <div class="name"> deletesTree </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a> should also delete subtrees.<span class="nodetails" id="xpropdeletesTree"><a class="morelink" onclick="hst('propdeletesTree')">More...</a></span> <span class="details" id="propdeletesTree"> The default value is false. Setting this property does not raise any events.</span> </div> </td> </tr> <tr id="diagram" > <td class="name"> <div class="name"> diagram </div> <div class="attributes"> <span class="light">{<a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a>}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>This read-only property returns the <a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a> that is using this CommandHandler, after <a href="../symbols/Diagram.html#commandHandler" class="linkProperty">Diagram.commandHandler</a> has been set to this object. </div> </td> </tr> <tr id="memberValidation" > <td class="name"> <div class="name"> memberValidation </div> <div class="attributes"> <span class="light">{function(Group, Part):boolean | null}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the predicate that determines whether or not a node may become a member of a group.<span class="nodetails" id="xpropmemberValidation"><a class="morelink" onclick="hst('propmemberValidation')">More...</a></span> <span class="details" id="propmemberValidation"> This predicate is called in addition to any existing group's <a href="../symbols/Group.html#memberValidation" class="linkProperty">Group.memberValidation</a> predicate. The default predicate is null, which is equivalent to simply returning true. The predicate may be called passing null as the first argument (the Group) -- this asks whether it is OK to make the second argument (the Part, but not a Link) a top-level Part of the diagram. <p class="box"> For a more general discussion of validation, see <a href="../../intro/validation.html">Introduction to Validation</a>. </span><div class="details" id="dpropmemberValidation"><p> The function, if supplied, must not have any side-effects.</div> </div> </td> </tr> <tr id="zoomFactor" > <td class="name"> <div class="name"> zoomFactor </div> <div class="attributes"> <span class="light">{number}</span> <span class="since" title="since">1.1</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the amount by which <a href="../symbols/CommandHandler.html#decreaseZoom" class="linkMethod">decreaseZoom</a> and <a href="../symbols/CommandHandler.html#increaseZoom" class="linkMethod">increaseZoom</a> change the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a>.<span class="nodetails" id="xpropzoomFactor"><a class="morelink" onclick="hst('propzoomFactor')">More...</a></span> <span class="details" id="propzoomFactor"> </span><div class="details" id="dpropzoomFactor"><p> The default value is 1.05 (5%). The value must be a number larger than 1.0. Setting this property does not raise any events.</div> </div> </td> </tr> </tbody> </table> </div><!-- class="table-responsive">--> <!-- ============================== methods summary ======================== --> <h2 class="summaryCaption">Method <span class="nodetails"> Summary</span><span class="details"> Details</span></h2> <div class="table-responsive"> <table class="summaryTable table table-bordered table-condensed" summary="A summary of the methods documented in the class CommandHandler."> <thead> <tr> <th scope="col" class="name">Name, Return Type</th> <th scope="col" class="description">Description</th> </tr> </thead> <tbody> <tr id="addTopLevelParts"> <td class="name"> <div class="name"> addTopLevelParts(coll, check) </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description"> <div class="description"> <!--newp--><p><p>Make sure all of the unnested <a href="../symbols/Part.html" class="linkConstructor">Part</a>s in the given collection are removed from any containing <a href="../symbols/Group.html" class="linkConstructor">Group</a>s.<span class="nodetails" id="xmethaddTopLevelParts"><a class="morelink" onclick="hst('methaddTopLevelParts')">More...</a></span> <span class="details" id="methaddTopLevelParts"> </span><div class="details" id="dmethaddTopLevelParts"><p> This sets <a href="../symbols/Part.html#containingGroup" class="linkProperty">Part.containingGroup</a> to null on each Part that is not a member of another Part in the argument collection. If the check argument to this method is supplied and true, this will call <a href="../symbols/CommandHandler.html#isValidMember" class="linkMethod">isValidMember</a> on each part, passing null as the first argument. <p> This functionality is similar to <a href="../symbols/CommandHandler.html#ungroupSelection" class="linkMethod">ungroupSelection</a>, except that this is not a command (there is no transaction and this does not raise a <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>) and the parts are necessarily becoming top-level parts (whereas ungrouping would add them to the Group containing the Group being ungrouped). <p> This function is typically called in a <a href="../symbols/Diagram.html#mouseDrop" class="linkProperty">Diagram.mouseDrop</a> event handler in order to remove the selected Parts from whatever <a href="../symbols/Group.html" class="linkConstructor">Group</a> they had been in. <p> If you want to add Parts to be members of a Group, call <a href="../symbols/Group.html#addMembers" class="linkMethod">Group.addMembers</a>. If you want to remove Parts completely from a Diagram, call <a href="../symbols/Diagram.html#removeParts" class="linkMethod">Diagram.removeParts</a>. <p> This method may be overridden, but you should consider calling this base method in order to get all of its functionality. 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.</div> <dl class="detailList"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{Iterable.<Part>}</span> <b>coll</b> </dt> <dd>a collection of Parts.</dd> <dt> <span class="light fixedFont">{boolean=}</span> <b>check</b> </dt> <dd>whether to call <a href="../symbols/CommandHandler.html#isValidMember" class="linkMethod">isValidMember</a> to confirm that changing the Part to be a top-level Part is valid.</dd> </dl> <dl class="detailList"> <dt class="heading">Returns:</dt> <dt><span class="light fixedFont">{boolean}</span> true if all non-Links were changed to be top-level Parts in this Diagram; false if some Parts or Nodes were not able to be added.</dt> </dl> </div> </td> </tr> <tr id="canCollapseSubGraph"> <td class="name"> <div class="name"> canCollapseSubGraph(group) </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description">