82 lines
2.7 KiB
HTML
82 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Parallel Route Links</title>
|
|
<meta name="description" content="Custom non-Orthogonal non-Bezier Links that have parallel routings for multiple links connecting the same pair of ports." />
|
|
<!-- Copyright 1998-2017 by Northwoods Software Corporation. -->
|
|
<meta charset="UTF-8">
|
|
<script src="../release/go.js"></script>
|
|
<script src="../assets/js/goSamples.js"></script> <!-- this is only for the GoJS Samples framework -->
|
|
<script src="ParallelRouteLink.js"></script>
|
|
<script id="code">
|
|
function init() {
|
|
if (window.goSamples) goSamples(); // init for these samples -- you don't need to call this
|
|
|
|
var $ = go.GraphObject.make;
|
|
|
|
myDiagram =
|
|
$(go.Diagram, "myDiagramDiv",
|
|
{
|
|
initialContentAlignment: go.Spot.Center,
|
|
"undoManager.isEnabled": true
|
|
});
|
|
|
|
myDiagram.nodeTemplate =
|
|
$(go.Node, "Auto",
|
|
new go.Binding("location", "loc", go.Point.parse),
|
|
$(go.Shape,
|
|
{
|
|
portId: "",
|
|
fromLinkable: true, toLinkable: true,
|
|
fromLinkableDuplicates: true, toLinkableDuplicates: true,
|
|
cursor: "pointer"
|
|
},
|
|
new go.Binding("fill", "color")),
|
|
$(go.TextBlock,
|
|
{ margin: 8 },
|
|
new go.Binding("text"))
|
|
);
|
|
|
|
myDiagram.linkTemplate =
|
|
$(ParallelRouteLink,
|
|
{
|
|
relinkableFrom: true, relinkableTo: true,
|
|
reshapable: true //, resegmentable: true
|
|
},
|
|
$(go.Shape, { strokeWidth: 2 },
|
|
new go.Binding("stroke", "fromNode", function(node) { return node.port.fill; }).ofObject()),
|
|
$(go.Shape, { toArrow: "OpenTriangle", strokeWidth: 1.5 },
|
|
new go.Binding("stroke", "fromNode", function(node) { return node.port.fill; }).ofObject())
|
|
);
|
|
|
|
myDiagram.model = new go.GraphLinksModel(
|
|
[
|
|
{ key: 1, text: "Alpha", color: "lightblue", loc: "0 0" },
|
|
{ key: 2, text: "Beta", color: "orange", loc: "130 70" },
|
|
{ key: 3, text: "Gamma", color: "lightgreen", loc: "0 130" }
|
|
],
|
|
[
|
|
{ from: 1, to: 2 },
|
|
{ from: 2, to: 1 },
|
|
{ from: 1, to: 3 },
|
|
{ from: 1, to: 3 },
|
|
{ from: 3, to: 1 },
|
|
{ from: 1, to: 3 },
|
|
{ from: 1, to: 3 }
|
|
]);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="init()">
|
|
<div id="sample">
|
|
<div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:600px"></div>
|
|
<p>
|
|
A <b>ParallelRouteLink</b> is a custom <a>Link</a> that overrides <a>Link.computePoints</a>
|
|
in order to produce a middle segment that is parallel to the routes of other <b>ParallelRouteLink</b>s
|
|
connecting the same two ports.
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
|