UNPKG

23.5 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4<meta charset="utf-8"/>
5<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover"/>
6
7<link rel="stylesheet" href="../assets/css/style.css"/>
8<!-- Copyright 1998-2021 by Northwoods Software Corporation. --> <title> GoJS Commands -- Northwoods Software </title>
9 <link rel="stylesheet" href="../assets/css/prism.css" />
10 </head>
11 <script>
12
13 window.diagrams = [];
14 window.goCode = function(pre, w, h, parentid, animation) {
15 window.diagrams.push([pre, w, h, parentid, animation]);
16 }
17 </script>
18 <body>
19 <nav id="navTop" class="w-full z-30 top-0 text-white bg-nwoods-primary">
20 <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">
21 <div class="md:pl-4">
22 <a class="text-white hover:text-white no-underline hover:no-underline
23 font-bold text-2xl lg:text-4xl rounded-lg hover:bg-nwoods-secondary " href="../">
24 <h1 class="mb-0 p-1 ">GoJS</h1>
25 </a>
26 </div>
27 <button id="topnavButton" class="rounded-lg sm:hidden focus:outline-none focus:ring" aria-label="Navigation">
28 <svg fill="currentColor" viewBox="0 0 20 20" class="w-6 h-6">
29 <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>
30 <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>
31 </svg>
32 </button>
33 <div id="topnavList" class="hidden sm:block items-center w-auto mt-0 text-white p-0 z-20">
34 <ul class="list-reset list-none font-semibold flex justify-end flex-wrap sm:flex-nowrap items-center px-0 pb-0">
35 <li class="p-1 sm:p-0"><a class="topnav-link" href="../learn/">Learn</a></li>
36 <li class="p-1 sm:p-0"><a class="topnav-link" href="../samples/">Samples</a></li>
37 <li class="p-1 sm:p-0"><a class="topnav-link" href="../intro/">Intro</a></li>
38 <li class="p-1 sm:p-0"><a class="topnav-link" href="../api/">API</a></li>
39 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/products/register.html">Register</a></li>
40 <li class="p-1 sm:p-0"><a class="topnav-link" href="../download.html">Download</a></li>
41 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://forum.nwoods.com/c/gojs/11">Forum</a></li>
42 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/contact.html"
43 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/contact.html', 'contact');">Contact</a></li>
44 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/sales/index.html"
45 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/sales/index.html', 'buy');">Buy</a></li>
46 </ul>
47 </div>
48 </div>
49 <hr class="border-b border-gray-600 opacity-50 my-0 py-0" />
50 </nav>
51
52 <div class="md:flex flex-col md:flex-row md:min-h-screen w-full max-w-screen-xl mx-auto">
53
54 <div id="navSide" class="flex flex-col w-full md:w-40 lg:w-48 text-gray-700 bg-white flex-shrink-0">
55 <div class="flex-shrink-0 px-8 py-4">
56 <button id="navButton" class="rounded-lg md:hidden focus:outline-none focus:ring" aria-label="Navigation">
57 <svg fill="currentColor" viewBox="0 0 20 20" class="w-6 h-6">
58 <path id="navOpen" 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>
59 <path id="navClosed" 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>
60 </svg>
61 </button>
62 </div>
63 <nav id="navList" class="min-h-screen hidden md:block sidebar-nav flex-grow px-1 lg:px-4 pb-4 md:pb-0 md:overflow-y-auto break-words">
64 <a href="index.html">Basics</a>
65 <a href="buildingObjects.html">Building Parts</a>
66 <a href="usingModels.html">Using Models</a>
67 <a href="dataBinding.html">Data Binding</a>
68 <a href="react.html">GoJS with React</a>
69 <a href="angular.html">GoJS with Angular</a>
70 <a href="textBlocks.html">TextBlocks</a>
71 <a href="shapes.html">Shapes</a>
72 <a href="pictures.html">Pictures</a>
73 <a href="panels.html">Panels</a>
74 <a href="tablePanels.html">Table Panels</a>
75 <a href="brush.html">Brushes</a>
76 <a href="sizing.html">Sizing Objects</a>
77 <a href="itemArrays.html">Item Arrays</a>
78 <a href="changedEvents.html">Changed Events</a>
79 <a href="transactions.html">Transactions</a>
80 <a href="viewport.html">Coordinates</a>
81 <a href="initialView.html">Initial View</a>
82 <a href="collections.html">Collections</a>
83 <a href="links.html">Links</a>
84 <a href="linkLabels.html">Link Labels</a>
85 <a href="connectionPoints.html">Link Points</a>
86 <a href="ports.html">Ports</a>
87 <a href="nodes.html">Nodes</a>
88 <a href="debugging.html">Debugging</a>
89 <a href="layouts.html">Layouts</a>
90 <a href="trees.html">Trees</a>
91 <a href="subtrees.html">SubTrees</a>
92 <a href="groups.html">Groups</a>
93 <a href="subgraphs.html">SubGraphs</a>
94 <a href="sizedGroups.html">Sized Groups</a>
95 <a href="selection.html">Selection</a>
96 <a href="highlighting.html">Highlighting</a>
97 <a href="animation.html">Animation</a>
98 <a href="toolTips.html">ToolTips</a>
99 <a href="contextmenus.html">Context Menus</a>
100 <a href="events.html">Diagram Events</a>
101 <a href="tools.html">Tools</a>
102 <a href="commands.html">Commands</a>
103 <a href="permissions.html">Permissions</a>
104 <a href="validation.html">Validation</a>
105 <a href="HTMLInteraction.html">HTML Interaction</a>
106 <a href="layers.html">Layers &amp; Z-ordering</a>
107 <a href="palette.html">Palette</a>
108 <a href="overview.html">Overview</a>
109 <a href="resizing.html">Resizing Diagrams</a>
110 <a href="replacingDeleting.html">Replacing and Deleting</a>
111 <a href="buttons.html">Buttons</a>
112 <a href="templateMaps.html">Template Maps</a>
113 <a href="legends.html">Legends and Titles</a>
114 <a href="extensions.html">Extensions</a>
115 <a href="geometry.html">Geometry Strings</a>
116 <a href="grids.html">Grid Patterns</a>
117 <a href="graduatedPanels.html">Graduated Panels</a>
118 <a href="makingImages.html">Diagram Images</a>
119 <a href="makingSVG.html">Diagram SVG</a>
120 <a href="printing.html">Printing</a>
121 <a href="serverSideImages.html">Server-side Images</a>
122 <a href="nodeScript.html">GoJS in Node.js</a>
123 <a href="testing.html">Testing</a>
124 <a href="storage.html">Storage</a>
125 <a href="performance.html">Performance</a>
126 <a href="source.html">Building from Source</a>
127 <a href="platforms.html">Platforms</a>
128 <a href="deployment.html">Deployment</a>
129 </nav>
130 </div>
131 <div class="pt-4 px-2 md:px-0 lg:px-4 pb-16 w-full overflow-hidden">
132
133
134
135
136<h1>Commands</h1>
137<p>
138Commands such as <b>Delete</b> or <b>Paste</b> or <b>Undo</b> are implemented by the <a>CommandHandler</a> class.
139</p>
140<p>
141Keyboard events, like mouse and touch events, always go to the <a>Diagram.currentTool</a>.
142The current tool, when the user is not performing some gesture, is the same as the <a>Diagram.defaultTool</a>,
143which normally is the <a>Diagram.toolManager</a>.
144The <a>ToolManager</a> handles keyboard events by delegating them to the <a>Diagram.commandHandler</a>.
145</p>
146<p>
147Basically, the diagram handles a keyboard event, creates an <a>InputEvent</a> describing it,
148and then calls <a>ToolManager.doKeyDown</a>. That in turn just calls <a>CommandHandler.doKeyDown</a>.
149The same sequence happens for key-up events.
150</p>
151<p>
152Please note that the handling of keyboard commands depends on the diagram getting focus and then getting keyboard events.
153Do not apply any styling such as <pre class="lang-css"><code>canvas:focus { display: none; }</code></pre>.
154</p>
155
156<h2 id="KeyboardCommandBindings">Keyboard command bindings</h2>
157<p>
158The <a>CommandHandler</a> implements the following command bindings for keyboard input:
159</p>
160<ul>
161 <li>Del &amp; Backspace invoke <a>CommandHandler.deleteSelection</a></li>
162 <li>Ctrl-X &amp; Shift-Del invoke <a>CommandHandler.cutSelection</a></li>
163 <li>Ctrl-C &amp; Ctrl-Insert invoke <a>CommandHandler.copySelection</a></li>
164 <li>Ctrl-V &amp; Shift-Insert invoke <a>CommandHandler.pasteSelection</a></li>
165 <li>Ctrl-A invokes <a>CommandHandler.selectAll</a></li>
166 <li>Ctrl-Z &amp; Alt-Backspace invoke <a>CommandHandler.undo</a></li>
167 <li>Ctrl-Y &amp; Alt-Shift-Backspace invoke <a>CommandHandler.redo</a></li>
168 <li>Up &amp; Down &amp; Left &amp; Right (arrow keys) call <a>Diagram.scroll</a></li>
169 <li>PageUp &amp; PageDown call <a>Diagram.scroll</a></li>
170 <li>Home &amp; End call <a>Diagram.scroll</a></li>
171 <li>Space invokes <a>CommandHandler.scrollToPart</a></li>
172 <li>Keypad-- (minus) invokes <a>CommandHandler.decreaseZoom</a></li>
173 <li>Keypad-+ (plus) invokes <a>CommandHandler.increaseZoom</a></li>
174 <li>Ctrl-0 invokes <a>CommandHandler.resetZoom</a></li>
175 <li>Shift-Z invokes <a>CommandHandler.zoomToFit</a>; repeat to return to the original scale and position</li>
176 <li>Ctrl-G invokes <a>CommandHandler.groupSelection</a></li>
177 <li>Ctrl-Shift-G invokes <a>CommandHandler.ungroupSelection</a></li>
178 <li>F2 invokes <a>CommandHandler.editTextBlock</a></li>
179 <li>Menu Key invokes <a>CommandHandler.showContextMenu</a></li>
180 <li>Esc invokes <a>CommandHandler.stopCommand</a></li>
181</ul>
182<p>
183On a Mac the Command key is used as the modifier instead of the Control key.
184</p>
185<p>
186At the current time there are no keyboard bindings for commands such as <a>CommandHandler.collapseSubGraph</a>,
187<a>CommandHandler.collapseTree</a>, <a>CommandHandler.expandSubGraph</a>, or <a>CommandHandler.expandTree</a>.
188</p>
189<p>
190If you want to have a different behavior for the arrow keys, consider using the sample class extended from <a>CommandHandler</a>:
191<a href="../extensions/DrawCommandHandler.js">DrawCommandHandler</a>, which implements options for having
192the arrow keys move the selection or change the selection.
193</p>
194<p>
195That DrawCommandHandler extension also demonstrates a customization of the <b>Copy</b> and <b>Paste</b> commands
196to automatically shift the location of pasted copies.
197</p>
198
199<h2 id="CommandHandler">CommandHandler</h2>
200<p>
201The <a>CommandHandler</a> class implements pairs of methods:
202a method to execute a command and a predicate that is true when the command may be executed.
203For example, for the <b>Copy</b> command, there is a <a>CommandHandler.copySelection</a> method
204and a <a>CommandHandler.canCopySelection</a> method.
205</p>
206<p>
207Keyboard event handling always calls the "can..." predicate first.
208Only if that returns true does it actually call the method to execute the command.
209</p>
210<p>
211There are a number of properties that you can set to affect the CommandHandler's standard behavior.
212For example, if you want to allow the user to group selected parts together with the <a>CommandHandler.groupSelection</a>,
213you will need to set <a>CommandHandler.archetypeGroupData</a> to a group node data object:
214</p>
215<pre class="lang-js"><code>
216 diagram.commandHandler.archetypeGroupData =
217 { key: "Group", isGroup: true, color: "blue" };
218</code></pre>
219<p>
220That data object is copied and added to the model as the new group data object by <a>CommandHandler.groupSelection</a>.
221</p>
222<p>
223If you want to add your own keyboard bindings, you can override the <a>CommandHandler.doKeyDown</a> method.
224For example, to support using the "T" key to collapse or expand the currently selected <a>Group</a>:
225</p>
226<pre class="lang-js"><code>
227 myDiagram.commandHandler.doKeyDown = function() {
228 var e = myDiagram.lastInput;
229 var cmd = myDiagram.commandHandler;
230 if (e.key === "T") { // could also check for e.control or e.shift
231 if (cmd.canCollapseSubGraph()) {
232 cmd.collapseSubGraph();
233 } else if (cmd.canExpandSubGraph()) {
234 cmd.expandSubGraph();
235 }
236 } else {
237 // call base method with no arguments
238 go.CommandHandler.prototype.doKeyDown.call(cmd);
239 }
240 };
241</code></pre>
242<p>
243Do not forget to call the base method in order to handle all of the keys that your method does not handle.
244</p>
245<p class="box bg-info">
246Note that calling the base method involves getting the base class's prototype's method.
247If the base method takes arguments, be sure to pass arguments to the call to the base method.
248</p>
249
250<h2 id="UpdatingCommandUI">Updating command UI</h2>
251<p>
252It is common to have HTML elements outside of the diagram that invoke commands.
253You can use the <a>CommandHandler</a>'s "can..." predicates to enable or disable UI that would invoke the command.
254</p>
255<pre class="lang-js" id="commands"><code>
256 // allow the group command to execute
257 diagram.commandHandler.archetypeGroupData =
258 { key: "Group", isGroup: true, color: "blue" };
259 // modify the default group template to allow ungrouping
260 diagram.groupTemplate.ungroupable = true;
261
262 var nodeDataArray = [
263 { key: "Alpha" },
264 { key: "Beta" },
265 { key: "Delta", group: "Epsilon" },
266 { key: "Gamma", group: "Epsilon" },
267 { key: "Epsilon", isGroup: true }
268 ];
269 var linkDataArray = [
270 { from: "Alpha", to: "Beta" },
271 { from: "Beta", to: "Beta" },
272 { from: "Gamma", to: "Delta" },
273 { from: "Delta", to: "Alpha" }
274 ];
275 diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
276
277 // enable or disable a particular button
278 function enable(name, ok) {
279 var button = document.getElementById(name);
280 if (button) button.disabled = !ok;
281 }
282 // enable or disable all command buttons
283 function enableAll() {
284 var cmdhnd = diagram.commandHandler;
285 enable("SelectAll", cmdhnd.canSelectAll());
286 enable("Cut", cmdhnd.canCutSelection());
287 enable("Copy", cmdhnd.canCopySelection());
288 enable("Paste", cmdhnd.canPasteSelection());
289 enable("Delete", cmdhnd.canDeleteSelection());
290 enable("Group", cmdhnd.canGroupSelection());
291 enable("Ungroup", cmdhnd.canUngroupSelection());
292 enable("Undo", cmdhnd.canUndo());
293 enable("Redo", cmdhnd.canRedo());
294 }
295 // notice whenever the selection may have changed
296 diagram.addDiagramListener("ChangedSelection", function(e) {
297 enableAll();
298 });
299 // notice when the Paste command may need to be reenabled
300 diagram.addDiagramListener("ClipboardChanged", function(e) {
301 enableAll();
302 });
303 // notice whenever a transaction or undo/redo has occurred
304 diagram.addModelChangedListener(function(e) {
305 if (e.isTransactionFinished) enableAll();
306 });
307 // perform initial enablements after everything has settled down
308 setTimeout(enableAll, 100);
309 // make the diagram accessible to button onclick handlers
310 myDiagram = diagram;
311 // calls enableAll() due to Model Changed listener
312 myDiagram.undoManager.isEnabled = true;
313</code></pre>
314<script>goCode("commands", 600, 150)</script>
315<input id="SelectAll" type="button" onclick="myDiagram.commandHandler.selectAll()" value="Select All" />
316<input id="Cut" type="button" onclick="myDiagram.commandHandler.cutSelection()" value="Cut" />
317<input id="Copy" type="button" onclick="myDiagram.commandHandler.copySelection()" value="Copy" />
318<input id="Paste" type="button" onclick="myDiagram.commandHandler.pasteSelection()" value="Paste" />
319<input id="Delete" type="button" onclick="myDiagram.commandHandler.deleteSelection()" value="Delete" />
320<input id="Group" type="button" onclick="myDiagram.commandHandler.groupSelection()" value="Group" />
321<input id="Ungroup" type="button" onclick="myDiagram.commandHandler.ungroupSelection()" value="Ungroup" />
322<input id="Undo" type="button" onclick="myDiagram.commandHandler.undo()" value="Undo" />
323<input id="Redo" type="button" onclick="myDiagram.commandHandler.redo()" value="Redo" />
324
325<p>
326Each button is implemented in the following fashion:
327</p>
328<pre class="lang-html"><code>
329&lt;input id="SelectAll" type="button"
330 onclick="myDiagram.commandHandler.selectAll()" value="Select All" /&gt;
331</code></pre>
332<p>
333Whenever the selection changes or whenever a transaction or undo or redo occurs,
334the enableAll function is called to update the "disabled" property of each of the buttons.
335</p>
336
337<h2 id="Accessibility">Accessibility</h2>
338<p>
339Since <b>GoJS</b> is based on the HTML Canvas element,
340making an app that is accessible to screen-readers or other accessibility devices
341is a matter of generating fallback content outside of GoJS,
342just as you would generate fallback content separate from any HTML Canvas application.
343</p>
344<p>
345Although much of the predefined functionality of the <a>CommandHandler</a> is accessible
346with keyboard commands or the default context menu, not all of it is,
347and the functionality of the <a>Tool</a>s mostly depends on mouse or touch events.
348We recommend that you implement alternative mechanisms specific to your application
349for those tools that you want your users to access without a pointing device.
350</p>
351
352<h2 id="MoreCommandHandlerOverrideExamples">More CommandHandler override examples</h2>
353
354<p>
355Stop CTRL+Z/CTRL+Y from doing an undo/redo, but still allow <a>CommandHandler.undo</a> and <a>CommandHandler.redo</a> to be called programatically:
356</p>
357<pre class="lang-js"><code>
358 myDiagram.commandHandler.doKeyDown = function() {
359 var e = myDiagram.lastInput;
360 // The meta (Command) key substitutes for "control" for Mac commands
361 var control = e.control || e.meta;
362 var key = e.key;
363 // Quit on any undo/redo key combination:
364 if (control && (key === 'Z' || key === 'Y')) return;
365
366 // call base method with no arguments (default functionality)
367 go.CommandHandler.prototype.doKeyDown.call(this);
368 };
369</code></pre>
370
371 </div>
372 </div>
373
374 <div class="bg-nwoods-primary">
375 <section class="max-w-screen-lg text-white container mx-auto py-2 px-12">
376 <p id="version" class="leading-none mb-2 my-4">GoJS</p>
377 </section>
378 </div><footer class="bg-nwoods-primary text-white">
379 <div class="container max-w-screen-lg mx-auto px-8">
380 <div class="w-full py-6">
381
382 <div class="max-w-screen-lg xl:max-w-screen-xl mx-auto px-4 sm:px-6 md:px-8">
383 <ul class="text-sm font-medium pb-14 sm:pb-20 grid grid-cols-1 sm:grid-cols-3 gap-y-10">
384 <li class="list-none row-span-2">
385 <h2 class="text-base font-semibold tracking-wide">GoJS</h2>
386 <ul class="list-none space-y-4 md:space-y-1 px-0">
387 <li>
388 <a href="../samples/index.html">Samples</a>
389 </li>
390 <li>
391 <a href="../learn/index.html">Learn</a>
392 </li>
393 <li>
394 <a href="../intro/index.html">Intro</a>
395 </li>
396 <li>
397 <a href="../api/index.html">API</a>
398 </li>
399 <li>
400 <a href="../changelog.html">Changelog</a>
401 </li>
402 <li>
403 <a href="https://github.com/NorthwoodsSoftware/GoJS">GitHub</a>
404 </li>
405 </ul>
406 </li>
407 <li class="list-none row-span-2">
408 <h2 class="text-base font-semibold tracking-wide">Support</h2>
409 <ul class="list-none space-y-4 md:space-y-1 px-0">
410 <li>
411 <a href="https://www.nwoods.com/contact.html"
412 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/contact.html', 'contact');">Contact</a>
413 </li>
414 <li>
415 <a href="https://forum.nwoods.com/c/gojs">Forum</a>
416 </li>
417 <li>
418 <a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a>
419 </li>
420 <li>
421 <a href="https://www.nwoods.com/sales/index.html"
422 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/sales/index.html', 'buy');">Buy</a>
423 </li>
424 <li>
425 <a href="https://www.youtube.com/channel/UC9We8EoX596-6XFjJDtZIDg">Videos</a>
426 </li>
427 </ul>
428 </li>
429 <li class="list-none row-span-2">
430 <h2 class="text-base font-semibold tracking-wide">Company</h2>
431 <ul class="list-none space-y-4 md:space-y-1 px-0">
432 <li>
433 <a href="https://www.nwoods.com">Northwoods</a>
434 </li>
435 <li>
436 <a href="https://www.nwoods.com/about.html">About Us</a>
437 </li>
438 <li>
439 <a href="https://www.nwoods.com/contact.html">Contact Us</a>
440 </li>
441 <li>
442 <a href="https://twitter.com/northwoodsgo">Twitter</a>
443 </li>
444
445 </ul>
446 </li>
447 </ul>
448
449
450 <p class="text-sm text-gray-100 md:mb-6">
451 Copyright 1998-2021 <a class="text-white" href="https://www.nwoods.com">Northwoods Software</a>
452 </p>
453 </div>
454 </div>
455</footer> </body>
456
457<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1506307-5"></script>
458<script>
459 window.dataLayer = window.dataLayer || [];
460 function gtag(){dataLayer.push(arguments);}
461 gtag('js', new Date()); gtag('config', 'UA-1506307-5');
462 var getOutboundLink = function(url, label) {
463 gtag('event', 'click', {
464 'event_category': 'outbound',
465 'event_label': label,
466 'transport_type': 'beacon'
467 });
468 }
469
470 // topnav
471 var topButton = document.getElementById("topnavButton");
472 var topnavList = document.getElementById("topnavList");
473 topButton.addEventListener("click", function() {
474 this.classList.toggle("active");
475 topnavList.classList.toggle("hidden");
476 document.getElementById("topnavOpen").classList.toggle("hidden");
477 document.getElementById("topnavClosed").classList.toggle("hidden");
478 });
479</script>
480 <script src="../assets/js/prism.js"></script>
481 <script src="../release/go.js"></script>
482 <script src="../assets/js/goDoc.js"></script>
483 <script>
484 document.addEventListener("DOMContentLoaded", function() {
485 if (window.go) document.getElementById('version').textContent = "GoJS version " + go.version;
486 if (window.goDoc) window.goDoc();
487 var d = window.diagrams;
488 for (var i = 0; i < d.length; i++) {
489 var dargs = d[i];
490 goCodeExecute(dargs[0], dargs[1], dargs[2], dargs[3], dargs[4]);
491 }
492 if (window.extra) window.extra();
493 });
494 </script>
495</html>