forked from flowhub/the-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
111 lines (89 loc) · 3.55 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Module object
var TheGraph = {};
// Bundle and expose fbp-graph as public API
TheGraph.fbpGraph = require('fbp-graph');
// Pull in Ease from NPM, react.animate needs it as a global
TheGraph.Ease = require('ease-component');
if (typeof window !== 'undefined' && typeof window.Ease === 'undefined') {
window.Ease = TheGraph.Ease;
}
var defaultNodeSize = 72;
var defaultNodeRadius = 8;
var moduleVars = {
// Context menus
contextPortSize: 36,
// Zoom breakpoints
zbpBig: 1.2,
zbpNormal: 0.4,
zbpSmall: 0.01,
config: {
nodeSize: defaultNodeSize,
nodeWidth: defaultNodeSize,
nodeRadius: defaultNodeRadius,
nodeHeight: defaultNodeSize,
autoSizeNode: true,
maxPortCount: 9,
nodeHeightIncrement: 12,
focusAnimationDuration: 1500
},
};
for (var key in moduleVars) {
TheGraph[key] = moduleVars[key];
}
if (typeof window !== 'undefined') {
// rAF shim
window.requestAnimationFrame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame;
}
// HACK, goes away when everything is CommonJS compatible
var g = { TheGraph: TheGraph };
TheGraph.factories = require('./the-graph/factories.js');
TheGraph.merge = require('./the-graph/merge.js');
require("./the-graph/the-graph-app.js").register(g);
require("./the-graph/the-graph-graph.js").register(g);
require("./the-graph/the-graph-node.js").register(g);
require("./the-graph/the-graph-node-menu.js").register(g);
require("./the-graph/the-graph-node-menu-port.js").register(g);
require("./the-graph/the-graph-node-menu-ports.js").register(g);
require("./the-graph/the-graph-port.js").register(g);
require("./the-graph/the-graph-edge.js").register(g);
require("./the-graph/the-graph-iip.js").register(g);
require("./the-graph/the-graph-group.js").register(g);
TheGraph.menu = require("./the-graph/the-graph-menu.js");
// compat
TheGraph.Menu = TheGraph.menu.Menu;
TheGraph.factories.menu = TheGraph.menu.factories;
TheGraph.config.menu = TheGraph.menu.config;
TheGraph.config.menu.iconRect.rx = TheGraph.config.nodeRadius;
TheGraph.config.menu.iconRect.ry = TheGraph.config.nodeRadius;
TheGraph.modalbg = require("./the-graph/the-graph-modalbg.js");
// compat
TheGraph.ModalBG = TheGraph.modalbg.ModalBG;
TheGraph.config.ModalBG = TheGraph.config.factories;
TheGraph.factories.ModalBG = TheGraph.modalbg.factories;
TheGraph.FONT_AWESOME = require("./the-graph/font-awesome-unicode-map.js");
var geometryutils = require('./the-graph/geometryutils');
// compat
TheGraph.findMinMax = geometryutils.findMinMax;
TheGraph.findNodeFit = geometryutils.findNodeFit;
TheGraph.findFit = geometryutils.findFit;
TheGraph.tooltip = require("./the-graph/the-graph-tooltip.js");
// compat
TheGraph.Tooltip = TheGraph.tooltip.Tooltip;
TheGraph.config.tooltip = TheGraph.tooltip.config;
TheGraph.factories.tooltip = TheGraph.tooltip.factories;
TheGraph.mixins = require("./the-graph/mixins.js");
TheGraph.arcs = require('./the-graph/arcs.js');
TheGraph.TextBG = require('./the-graph/TextBG.js');
TheGraph.SVGImage = require('./the-graph/SVGImage.js');
TheGraph.thumb = require('./the-graph-thumb/the-graph-thumb.js');
TheGraph.nav = require('./the-graph-nav/the-graph-nav.js');
TheGraph.autolayout = require('./the-graph/the-graph-autolayout.js');
TheGraph.library = require('./the-graph/the-graph-library.js');
TheGraph.clipboard = require("./the-graph-editor/clipboard.js");
TheGraph.editor = require('./the-graph-editor/menus.js');
TheGraph.render = require("./the-graph/render.js");
TheGraph.render.register(g);
module.exports = TheGraph;