1 |
|
2 |
|
3 |
|
4 | (function (factory) {
|
5 | if (typeof module === "object" && typeof module.exports === "object") {
|
6 | var v = factory(require, exports);
|
7 | if (v !== undefined) module.exports = v;
|
8 | }
|
9 | else if (typeof define === "function" && define.amd) {
|
10 | define(["require", "exports", "../release/go.js", "./RescalingTool.js"], factory);
|
11 | }
|
12 | })(function (require, exports) {
|
13 | "use strict";
|
14 | Object.defineProperty(exports, "__esModule", { value: true });
|
15 | exports.init = void 0;
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var go = require("../release/go.js");
|
24 | var RescalingTool_js_1 = require("./RescalingTool.js");
|
25 | function init() {
|
26 | if (window.goSamples)
|
27 | window.goSamples();
|
28 | var $ = go.GraphObject.make;
|
29 | var myDiagram = $(go.Diagram, "myDiagramDiv",
|
30 | {
|
31 | layout: $(go.TreeLayout),
|
32 | "undoManager.isEnabled": true
|
33 | });
|
34 |
|
35 | myDiagram.toolManager.mouseDownTools.add(new RescalingTool_js_1.RescalingTool());
|
36 | myDiagram.nodeTemplate =
|
37 | $(go.Node, "Auto", { locationSpot: go.Spot.Center }, new go.Binding("scale").makeTwoWay(), $(go.Shape, "RoundedRectangle", { strokeWidth: 0 }, new go.Binding("fill", "color")), $(go.TextBlock, { margin: 8 }, new go.Binding("text")));
|
38 |
|
39 |
|
40 | myDiagram.model = new go.GraphLinksModel([
|
41 | { key: 1, text: "Alpha", color: "lightblue" },
|
42 | { key: 2, text: "Beta", color: "orange" },
|
43 | { key: 3, text: "Gamma", color: "lightgreen" },
|
44 | { key: 4, text: "Delta", color: "pink" }
|
45 | ], [
|
46 | { from: 1, to: 2 },
|
47 | { from: 1, to: 3 },
|
48 | { from: 3, to: 4 }
|
49 | ]);
|
50 | }
|
51 | exports.init = init;
|
52 | });
|