This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(go.Node, 'Auto', | |
| $(go.Shape, | |
| 'Circle', { | |
| width: 100, | |
| height: 100, | |
| fill: 'white' | |
| }), | |
| $(go.Shape, | |
| 'Rectangle', { | |
| portId: '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(go.Node, | |
| 'Spot', | |
| $(go.Shape, { | |
| // ... | |
| }), | |
| $(go.Shape, | |
| 'Rectangle', { | |
| portId: 'entry', | |
| width: 20, | |
| height: 20, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diagram.model = $(go.GraphLinksModel, { | |
| linkFromPortIdProperty: 'fromPort', | |
| linkToPortIdProperty: 'toPort', | |
| nodeDataArray: [ | |
| // ... | |
| ], | |
| linkDataArray: [ | |
| {from: 1, to: 2, toPort: 'entry'}, | |
| {from: 2, to: 3, fromPort: 'exit', toPort: 'entry'}, | |
| {from: 1, to: 3, toPort: 'entry'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="palette-content" style="height: 800px; width: 200px; display: inline-block; border: 1px solid black"></div> | |
| <div id="diagram-content" style="height: 800px; width: calc(100% - 220px); display: inline-block; border: 1px solid black;"></div> | |
| <script> | |
| window.onload = function() { | |
| diagram.initDiagram(); | |
| diagram.initPalette(); | |
| }; | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var initDiagram = function () { | |
| diagram = $(go.Diagram, | |
| 'diagram-content', { | |
| initialContentAlignment: go.Spot.Center, | |
| allowDrop: true | |
| }); | |
| // ... | |
| } | |
| var initPalette = function () { | |
| palette = $(go.Palette, 'palette-content'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diagram.grid.visible = true; | |
| diagram.toolManager.draggingTool.isGridSnapEnabled = true; | |
| diagram.toolManager.draggingTool.gridSnapCellSize = new go.Size(50, 50); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diagram = $(go.Diagram, | |
| 'diagram-content', { | |
| initialContentAlignment: go.Spot.Center, | |
| allowDrop: true, | |
| layout: $(go.LayeredDigraphLayout) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Triple = [string, number, boolean]; | |
| const a: Triple = ['a', 2, false]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type StringAndNumbers = [string, ...number[]]; | |
| const b1: StringAndNumbers = ['a', 1, 2, 3]; | |
| const b2: StringAndNumbers = ['a']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Strings = [...string]; | |
| type Empty = []; | |
| const c1: Strings = ['a', 'b']; | |
| const c2: Strings = []; | |
| const c3: Empty = []; | |
| const c4: Empty = ['a', 'b']; // invalid type |