Queple Cave Map
by Michael Tran
HTML
<script src="https://unpkg.com/gojs/release/go-debug.js"></script>
<!DOCTYPE html> <!-- HTML5 document type -->
<html>
<head>
</head>
<body>
<div id="myDiagramDiv" style="width:1600px; height:900px; background-color: #DAE4E4;">
</div>
<script src="script.js"></script>
</body>
</html>
JavaScript
var $ = go.GraphObject.make;
var myDiagram = $(go.Diagram, "myDiagramDiv", {
//layout: $(go.LayeredDigraphLayout, {direction: 90, layerSpacing: 50, columnSpacing: 100}),
layout: $(go.TreeLayout, {angle: 90, layerSpacing: 120, nodeSpacing: 120}),
"undoManager.isEnabled": true // enable Ctrl-Z to undo and Ctrl-Y to redo
});
// define the "sample" Node template
myDiagram.nodeTemplate =
$(go.Node, "Auto",
//new go.Binding("location"),
$(go.Shape, "RoundedRectangle", // define the node's outer shape
{ fill: "white", stroke: "black" },
new go.Binding("fill", "color")),
$(go.TextBlock, // define the node's text
{ margin: 5 },
new go.Binding("text", "key"))
);
myDiagram.linkTemplate =
$(go.Link,
{ routing: go.Link.AvoidsNodes,
curve: go.Link.JumpOver } ,
$(go.Shape, { strokeWidth: 1.5 }),
$(go.Shape, { toArrow: "Standard" }),
$(go.Panel, "Auto",
$(go.Shape, "Rectangle", {fill: "white", stroke: "grey"}),
$(go.TextBlock, {
margin: 3,
},
new go.Binding("text", "text"), {
//segmentOffset: new go.Point(NaN, NaN)
}),
{
segmentOffset: new go.Point(0, 0)
},
new go.Binding("segmentOffset", "seg")
)
);
myDiagram.model = new go.GraphLinksModel(
[
{ key: "Entrance", color: "" },
{ key: "Dark Tunnel", color: "" },
{ key: "Dark Tunnel West", color: "" },
{ key: "West Tunnel West", color: "" },
{ key: "Western Deadend", color: "" },
{ key: "Copper Motherlode", color: "" },
{ key: "Dark Tunnel East", color: "" },
{ key: "Deep Tunnel West", color: "" },
{ key: "West Tunnel", color: "" },
{ key: "Western Dwarf Home", color: "" },
{ key: "Deep Tunnel", color: "" },
{ key: "Smithy", color: "" },
{ key: "Wet Tunnel", color: "" },
{ key: "Wet Tunnel West", color: "" },
{ key: "Wet Tunnel East", color: "" },
{ key: "Deep Tunnel East", color: "" },
{ key: "River", color: "" },
{ key: "Tin Motherlode", color: "" },
{...