UNPKG

1.54 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.EdgeDisplayData = exports.NodeDisplayData = void 0;
4/**
5 * Sigma.js Display Data Classes
6 * ==============================
7 *
8 * Classes representing nodes & edges display data aiming at facilitating
9 * the engine's memory representation and keep them in a pool to avoid
10 * requiring to allocate memory too often.
11 *
12 * NOTE: it's possible to optimize this further by maintaining display data
13 * in byte arrays but this would prove more tedious for the rendering logic
14 * afterwards.
15 */
16var NodeDisplayData = /** @class */ (function () {
17 function NodeDisplayData(index, settings) {
18 this.index = index;
19 this.x = 0;
20 this.y = 0;
21 this.size = 2;
22 this.color = settings.defaultNodeColor;
23 this.hidden = false;
24 this.label = "";
25 }
26 NodeDisplayData.prototype.assign = function (data) {
27 for (var key in data)
28 this[key] = data[key];
29 };
30 return NodeDisplayData;
31}());
32exports.NodeDisplayData = NodeDisplayData;
33var EdgeDisplayData = /** @class */ (function () {
34 function EdgeDisplayData(index, settings) {
35 this.index = index;
36 this.size = 1;
37 this.color = settings.defaultEdgeColor;
38 this.hidden = false;
39 this.label = "";
40 }
41 EdgeDisplayData.prototype.assign = function (data) {
42 for (var key in data)
43 this[key] = data[key];
44 };
45 return EdgeDisplayData;
46}());
47exports.EdgeDisplayData = EdgeDisplayData;