UNPKG

653 BJavaScriptView Raw
1/**
2 * Adds layout seed to Network unless supplied explicitly. The intention here
3 * is to make the layout stable that is to keep the layout the same on every
4 * screenshot.
5 */
6(() => {
7 window.vis = {};
8 let Network = undefined;
9
10 Object.defineProperty(window.vis, "Network", {
11 get() {
12 return function StableNetwork(container, data, options, ...args) {
13 options = options || {};
14 options.layout = options.layout || {};
15 options.layout.randomSeed = options.layout.randomSeed || 0;
16 return new Network(container, data, options, ...args);
17 };
18 },
19 set(value) {
20 Network = value;
21 }
22 });
23})();