@linkurious/ogma-linkurious-parser 3.1.11 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/captions/captions.js +39 -50
- package/dist/captions/captions.js.map +1 -1
- package/dist/filters/filters.js +54 -76
- package/dist/filters/filters.js.map +1 -1
- package/dist/ogma/features/OgmaStore.js +15 -30
- package/dist/ogma/features/OgmaStore.js.map +1 -1
- package/dist/ogma/features/captions.js +42 -87
- package/dist/ogma/features/captions.js.map +1 -1
- package/dist/ogma/features/reactive.js +57 -75
- package/dist/ogma/features/reactive.js.map +1 -1
- package/dist/ogma/features/selectors.js +15 -15
- package/dist/ogma/features/selectors.js.map +1 -1
- package/dist/ogma/features/styles.js +114 -137
- package/dist/ogma/features/styles.js.map +1 -1
- package/dist/ogma/features/transformations.js +46 -94
- package/dist/ogma/features/transformations.js.map +1 -1
- package/dist/ogma/index.js +138 -221
- package/dist/ogma/index.js.map +1 -1
- package/dist/styles/edgeAttributes.js +30 -46
- package/dist/styles/edgeAttributes.js.map +1 -1
- package/dist/styles/itemAttributes.js +31 -41
- package/dist/styles/itemAttributes.js.map +1 -1
- package/dist/styles/nodeAttributes.js +48 -71
- package/dist/styles/nodeAttributes.js.map +1 -1
- package/dist/styles/styleRule.js +56 -68
- package/dist/styles/styleRule.js.map +1 -1
- package/dist/styles/styleRules.js +149 -192
- package/dist/styles/styleRules.js.map +1 -1
- package/dist/tools/ogmaTool.js +27 -30
- package/dist/tools/ogmaTool.js.map +1 -1
- package/dist/tools/tools.js +87 -91
- package/dist/tools/tools.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
const __1 = require("../..");
|
|
4
|
+
const tools_1 = require("../../tools/tools");
|
|
5
|
+
const HOVERED_SELECTED_NODE_STYLE = {
|
|
17
6
|
text: {
|
|
18
7
|
style: 'bold',
|
|
19
8
|
backgroundColor: '#fff',
|
|
@@ -22,7 +11,7 @@ var HOVERED_SELECTED_NODE_STYLE = {
|
|
|
22
11
|
outerStroke: { width: 2 },
|
|
23
12
|
outline: false
|
|
24
13
|
};
|
|
25
|
-
|
|
14
|
+
const HOVERED_SELECTED_EDGE_STYLE = {
|
|
26
15
|
text: {
|
|
27
16
|
style: 'bold',
|
|
28
17
|
backgroundColor: '#fff',
|
|
@@ -30,25 +19,25 @@ var HOVERED_SELECTED_EDGE_STYLE = {
|
|
|
30
19
|
},
|
|
31
20
|
outline: false
|
|
32
21
|
};
|
|
33
|
-
|
|
22
|
+
const NODE_HALO_CONFIGURATION = {
|
|
34
23
|
color: '#FFF',
|
|
35
24
|
width: 7,
|
|
36
25
|
scalingMethod: 'scaled',
|
|
37
26
|
strokeWidth: 0,
|
|
38
27
|
hideNonAdjacentEdges: false
|
|
39
28
|
};
|
|
40
|
-
|
|
29
|
+
const EDGE_HALO_CONFIGURATION = {
|
|
41
30
|
color: '#FFF',
|
|
42
31
|
scalingMethod: 'scaled',
|
|
43
32
|
width: 4
|
|
44
33
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
const DEFAULT_OGMA_FONT = "'roboto', sans-serif";
|
|
35
|
+
const DARK_FONT_COLOR = '#000';
|
|
36
|
+
const CLEAR_FONT_COLOR = '#FFF';
|
|
37
|
+
const ITEM_DEFAULT_COLOR = '#7f7f7f';
|
|
49
38
|
exports.FILTER_OPACITY = 0.2;
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
class StylesViz {
|
|
40
|
+
constructor(ogma, configuration) {
|
|
52
41
|
this._nodeAttributes = new __1.NodeAttributes({});
|
|
53
42
|
this._edgeAttributes = new __1.EdgeAttributes({});
|
|
54
43
|
this._ogma = ogma;
|
|
@@ -57,7 +46,7 @@ var StylesViz = /** @class */ (function () {
|
|
|
57
46
|
/**
|
|
58
47
|
* Set nodes default styles based on the configuration
|
|
59
48
|
*/
|
|
60
|
-
|
|
49
|
+
setNodesDefaultStyles() {
|
|
61
50
|
// setting selection and hover attributes
|
|
62
51
|
this._ogma.styles.setHoveredNodeAttributes(HOVERED_SELECTED_NODE_STYLE);
|
|
63
52
|
this._ogma.styles.setSelectedNodeAttributes(HOVERED_SELECTED_NODE_STYLE);
|
|
@@ -65,6 +54,7 @@ var StylesViz = /** @class */ (function () {
|
|
|
65
54
|
this._nodeDefaultStylesRules = this._ogma.styles.addRule({
|
|
66
55
|
nodeAttributes: {
|
|
67
56
|
text: {
|
|
57
|
+
padding: 5,
|
|
68
58
|
minVisibleSize: this._defaultConfiguration.node.text !== undefined &&
|
|
69
59
|
this._defaultConfiguration.node.text.minVisibleSize
|
|
70
60
|
? this._defaultConfiguration.node.text.minVisibleSize
|
|
@@ -109,11 +99,11 @@ var StylesViz = /** @class */ (function () {
|
|
|
109
99
|
outline: false
|
|
110
100
|
}
|
|
111
101
|
});
|
|
112
|
-
}
|
|
102
|
+
}
|
|
113
103
|
/**
|
|
114
104
|
* Set edges default styles based on the configuration
|
|
115
105
|
*/
|
|
116
|
-
|
|
106
|
+
setEdgesDefaultStyles() {
|
|
117
107
|
// setting selection and hover attributes
|
|
118
108
|
this._ogma.styles.setHoveredEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);
|
|
119
109
|
this._ogma.styles.setSelectedEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);
|
|
@@ -154,23 +144,22 @@ var StylesViz = /** @class */ (function () {
|
|
|
154
144
|
color: ITEM_DEFAULT_COLOR
|
|
155
145
|
}
|
|
156
146
|
});
|
|
157
|
-
}
|
|
147
|
+
}
|
|
158
148
|
/**
|
|
159
149
|
* Set nodes default styles based on the configuration
|
|
160
150
|
*/
|
|
161
|
-
|
|
162
|
-
var _this = this;
|
|
151
|
+
setNodesDefaultHalo() {
|
|
163
152
|
// setting default halo style
|
|
164
153
|
this._nodeDefaultHaloRules = this._ogma.styles.addRule({
|
|
165
|
-
nodeSelector:
|
|
154
|
+
nodeSelector: (node) => node && !node.hasClass('filtered'),
|
|
166
155
|
nodeAttributes: {
|
|
167
|
-
halo:
|
|
156
|
+
halo: (node) => {
|
|
168
157
|
if (node !== undefined &&
|
|
169
158
|
!node.hasClass('filtered') &&
|
|
170
159
|
(node.isSelected() ||
|
|
171
160
|
node.getAdjacentNodes({}).isSelected().includes(true) ||
|
|
172
161
|
node.getAdjacentEdges().isSelected().includes(true))) {
|
|
173
|
-
return
|
|
162
|
+
return Object.assign(Object.assign({}, NODE_HALO_CONFIGURATION), { scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled' });
|
|
174
163
|
}
|
|
175
164
|
return null;
|
|
176
165
|
}
|
|
@@ -189,23 +178,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
189
178
|
}
|
|
190
179
|
}
|
|
191
180
|
});
|
|
192
|
-
}
|
|
181
|
+
}
|
|
193
182
|
/**
|
|
194
183
|
* Set edges default styles based on the configuration
|
|
195
184
|
*/
|
|
196
|
-
|
|
197
|
-
var _this = this;
|
|
185
|
+
setEdgesDefaultHalo() {
|
|
198
186
|
// setting default halo styles
|
|
199
187
|
this._edgeDefaultHaloRules = this._ogma.styles.addRule({
|
|
200
|
-
edgeSelector:
|
|
201
|
-
return edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered');
|
|
202
|
-
},
|
|
188
|
+
edgeSelector: (edge) => edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered'),
|
|
203
189
|
edgeAttributes: {
|
|
204
|
-
halo:
|
|
190
|
+
halo: (edge) => {
|
|
205
191
|
if (edge &&
|
|
206
192
|
!edge.hasClass('filtered') &&
|
|
207
193
|
(edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())) {
|
|
208
|
-
return
|
|
194
|
+
return Object.assign(Object.assign({}, EDGE_HALO_CONFIGURATION), { scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled' });
|
|
209
195
|
}
|
|
210
196
|
return null;
|
|
211
197
|
}
|
|
@@ -221,36 +207,36 @@ var StylesViz = /** @class */ (function () {
|
|
|
221
207
|
}
|
|
222
208
|
}
|
|
223
209
|
});
|
|
224
|
-
}
|
|
210
|
+
}
|
|
225
211
|
/**
|
|
226
212
|
* Return the default node radius set in configuration or 5
|
|
227
213
|
*
|
|
228
214
|
* @returns {number}
|
|
229
215
|
*/
|
|
230
|
-
|
|
216
|
+
defaultNodeRadius(styles) {
|
|
231
217
|
return this.defaultStylesHas(styles, ['nodeRadius']) ? styles.nodeRadius : 5;
|
|
232
|
-
}
|
|
218
|
+
}
|
|
233
219
|
/**
|
|
234
220
|
* Return the default edge width set in configuration or 1
|
|
235
221
|
*
|
|
236
222
|
* @returns {number}
|
|
237
223
|
*/
|
|
238
|
-
|
|
224
|
+
defaultEdgeWidth(styles) {
|
|
239
225
|
return this.defaultStylesHas(styles, ['edgeWidth']) ? styles.edgeWidth : 1;
|
|
240
|
-
}
|
|
226
|
+
}
|
|
241
227
|
/**
|
|
242
228
|
* Check if a style property exists in the default styles object
|
|
243
229
|
*/
|
|
244
|
-
|
|
230
|
+
defaultStylesHas(styles, propertyPath) {
|
|
245
231
|
if (!tools_1.Tools.isDefined(styles)) {
|
|
246
232
|
return false;
|
|
247
233
|
}
|
|
248
234
|
return tools_1.Tools.getIn(styles, propertyPath) !== undefined;
|
|
249
|
-
}
|
|
235
|
+
}
|
|
250
236
|
/**
|
|
251
237
|
* Set styles for the class "filtered"
|
|
252
238
|
*/
|
|
253
|
-
|
|
239
|
+
setFilterClass() {
|
|
254
240
|
this._ogma.styles.createClass({
|
|
255
241
|
name: 'filtered',
|
|
256
242
|
nodeAttributes: {
|
|
@@ -287,11 +273,11 @@ var StylesViz = /** @class */ (function () {
|
|
|
287
273
|
width: 0.2
|
|
288
274
|
}
|
|
289
275
|
});
|
|
290
|
-
}
|
|
276
|
+
}
|
|
291
277
|
/**
|
|
292
278
|
* Set the class for exported nodes and edges
|
|
293
279
|
*/
|
|
294
|
-
|
|
280
|
+
setExportClass(textWrappingLength) {
|
|
295
281
|
if (!this._exportClass) {
|
|
296
282
|
this._exportClass = this._ogma.styles.createClass({
|
|
297
283
|
name: 'exported',
|
|
@@ -322,29 +308,28 @@ var StylesViz = /** @class */ (function () {
|
|
|
322
308
|
}
|
|
323
309
|
});
|
|
324
310
|
}
|
|
325
|
-
}
|
|
311
|
+
}
|
|
326
312
|
/**
|
|
327
313
|
* Set the rule to display badges
|
|
328
314
|
*/
|
|
329
|
-
|
|
330
|
-
var _this = this;
|
|
315
|
+
setBadgeRule() {
|
|
331
316
|
this._ogma.styles.createClass({
|
|
332
317
|
name: 'degreeIndicator',
|
|
333
318
|
nodeAttributes: {
|
|
334
319
|
badges: {
|
|
335
|
-
topRight:
|
|
320
|
+
topRight: (node) => {
|
|
336
321
|
if (node !== undefined) {
|
|
337
|
-
|
|
338
|
-
|
|
322
|
+
const degree = tools_1.Tools.getHiddenNeighbors(node.toList());
|
|
323
|
+
const badgeContent = tools_1.Tools.formatNumber(degree);
|
|
339
324
|
if (degree > 0) {
|
|
340
|
-
|
|
325
|
+
const nodeColor = Array.isArray(node.getAttribute('color'))
|
|
341
326
|
? node.getAttribute('color')[0]
|
|
342
327
|
: node.getAttribute('color');
|
|
343
|
-
|
|
328
|
+
const textColor = __1.OgmaTools.isBright(nodeColor)
|
|
344
329
|
? DARK_FONT_COLOR
|
|
345
330
|
: CLEAR_FONT_COLOR;
|
|
346
|
-
|
|
347
|
-
|
|
331
|
+
const isSupernode = node.getData(['statistics', 'supernode']);
|
|
332
|
+
let content = null;
|
|
348
333
|
if (+badgeContent !== 0) {
|
|
349
334
|
content = isSupernode ? badgeContent + '+' : badgeContent;
|
|
350
335
|
}
|
|
@@ -356,9 +341,9 @@ var StylesViz = /** @class */ (function () {
|
|
|
356
341
|
color: null
|
|
357
342
|
},
|
|
358
343
|
text: {
|
|
359
|
-
font:
|
|
360
|
-
|
|
361
|
-
?
|
|
344
|
+
font: this._defaultConfiguration.node.text !== undefined &&
|
|
345
|
+
this._defaultConfiguration.node.text.font !== undefined
|
|
346
|
+
? this._defaultConfiguration.node.text.font
|
|
362
347
|
: DEFAULT_OGMA_FONT,
|
|
363
348
|
scale: 0.4,
|
|
364
349
|
color: textColor,
|
|
@@ -375,12 +360,12 @@ var StylesViz = /** @class */ (function () {
|
|
|
375
360
|
name: 'pinnedIndicator',
|
|
376
361
|
nodeAttributes: {
|
|
377
362
|
badges: {
|
|
378
|
-
bottomRight:
|
|
363
|
+
bottomRight: (node) => {
|
|
379
364
|
if (node !== undefined && !node.getAttribute('layoutable')) {
|
|
380
|
-
|
|
365
|
+
const nodeColor = Array.isArray(node.getAttribute('color'))
|
|
381
366
|
? node.getAttribute('color')[0]
|
|
382
367
|
: node.getAttribute('color');
|
|
383
|
-
|
|
368
|
+
const textColor = __1.OgmaTools.isBright(nodeColor)
|
|
384
369
|
? DARK_FONT_COLOR
|
|
385
370
|
: CLEAR_FONT_COLOR;
|
|
386
371
|
return {
|
|
@@ -405,43 +390,42 @@ var StylesViz = /** @class */ (function () {
|
|
|
405
390
|
self: { attributes: ['layoutable'] }
|
|
406
391
|
}
|
|
407
392
|
});
|
|
408
|
-
this._ogma.events.on('addNodes',
|
|
409
|
-
this._ogma.events.on('addNodes',
|
|
410
|
-
}
|
|
393
|
+
this._ogma.events.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('degreeIndicator'));
|
|
394
|
+
this._ogma.events.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('pinnedIndicator'));
|
|
395
|
+
}
|
|
411
396
|
/**
|
|
412
397
|
* Delete the rule to display badges
|
|
413
398
|
*/
|
|
414
|
-
|
|
399
|
+
deleteBadgeRule() {
|
|
415
400
|
this._ogma.getNodes().removeClasses(['degreeIndicator', 'pinnedIndicator'], 0);
|
|
416
|
-
}
|
|
401
|
+
}
|
|
417
402
|
/**
|
|
418
403
|
* set text overlap to true or false
|
|
419
404
|
*
|
|
420
405
|
* @param {boolean} overlap
|
|
421
406
|
*/
|
|
422
|
-
|
|
407
|
+
toggleTextOverlap(overlap) {
|
|
423
408
|
this._ogma.setOptions({ texts: { preventOverlap: overlap } });
|
|
424
|
-
}
|
|
409
|
+
}
|
|
425
410
|
/**
|
|
426
411
|
* refresh nodes and edge rules
|
|
427
412
|
*
|
|
428
413
|
*/
|
|
429
|
-
|
|
414
|
+
refreshRules() {
|
|
430
415
|
this._nodeDefaultStylesRules.refresh();
|
|
431
416
|
this._edgeDefaultStylesRules.refresh();
|
|
432
|
-
}
|
|
417
|
+
}
|
|
433
418
|
/**
|
|
434
419
|
* Create / refresh an ogma rule for node colors
|
|
435
420
|
*/
|
|
436
|
-
|
|
437
|
-
var _this = this;
|
|
421
|
+
refreshNodeColors(colorStyleRules) {
|
|
438
422
|
if (!tools_1.Tools.isDefined(this._ogmaNodeColor)) {
|
|
439
423
|
this._nodeAttributes.refresh({ color: colorStyleRules });
|
|
440
424
|
this._ogmaNodeColor = this._ogma.styles.addRule({
|
|
441
425
|
nodeAttributes: {
|
|
442
|
-
color:
|
|
426
|
+
color: (node) => {
|
|
443
427
|
if (node !== undefined) {
|
|
444
|
-
return
|
|
428
|
+
return this._nodeAttributes.color(node.getData());
|
|
445
429
|
}
|
|
446
430
|
}
|
|
447
431
|
},
|
|
@@ -454,60 +438,59 @@ var StylesViz = /** @class */ (function () {
|
|
|
454
438
|
// TODO refresh node icons when moving the code from LKE
|
|
455
439
|
// this.refreshIconsColor();
|
|
456
440
|
}
|
|
457
|
-
}
|
|
441
|
+
}
|
|
458
442
|
/**
|
|
459
443
|
* Return an array of StyleRules with only the style that need to be applied
|
|
460
444
|
*/
|
|
461
|
-
|
|
445
|
+
getStyleRule(state, styleType) {
|
|
462
446
|
return new __1.StyleRules(state)[styleType];
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
447
|
+
}
|
|
448
|
+
initNodeColors(nodeRules) {
|
|
449
|
+
const nodeColorRules = this.getStyleRule(nodeRules, __1.StyleType.COLOR);
|
|
466
450
|
this.refreshNodeColors(nodeColorRules);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
451
|
+
}
|
|
452
|
+
initNodesIcons(nodeRules) {
|
|
453
|
+
const nodeIconsRules = this.getStyleRule(nodeRules, __1.StyleType.ICON);
|
|
470
454
|
this.refreshNodeIcons(nodeIconsRules);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
455
|
+
}
|
|
456
|
+
initNodesSizes(nodeRules) {
|
|
457
|
+
const nodeSizeRules = this.getStyleRule(nodeRules, __1.StyleType.SIZE);
|
|
474
458
|
this.refreshNodeSize(nodeSizeRules);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
459
|
+
}
|
|
460
|
+
initNodesShapes(nodeRules) {
|
|
461
|
+
const nodeShapesRules = this.getStyleRule(nodeRules, __1.StyleType.SHAPE);
|
|
478
462
|
this.refreshNodeShape(nodeShapesRules);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
463
|
+
}
|
|
464
|
+
initEdgesWidth(edgeRules) {
|
|
465
|
+
const edgesWidthRules = this.getStyleRule(edgeRules, __1.StyleType.WIDTH);
|
|
482
466
|
this.refreshEdgeWidth(edgesWidthRules);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
467
|
+
}
|
|
468
|
+
initEdgesShape(edgeRules) {
|
|
469
|
+
const edgesShapeRules = this.getStyleRule(edgeRules, __1.StyleType.SHAPE);
|
|
486
470
|
this.refreshEdgeShape(edgesShapeRules);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
|
|
471
|
+
}
|
|
472
|
+
initEdgesColor(edgeRules) {
|
|
473
|
+
const edgesColorRules = this.getStyleRule(edgeRules, __1.StyleType.COLOR);
|
|
490
474
|
this.refreshEdgeColors(edgesColorRules);
|
|
491
|
-
}
|
|
475
|
+
}
|
|
492
476
|
/**
|
|
493
477
|
* Create / refresh an ogma rule for node icons
|
|
494
478
|
*
|
|
495
479
|
* @param {Array<any>} iconStyleRules
|
|
496
480
|
*/
|
|
497
|
-
|
|
498
|
-
var _this = this;
|
|
481
|
+
refreshNodeIcons(iconStyleRules) {
|
|
499
482
|
if (!tools_1.Tools.isDefined(this._ogmaNodeIcon)) {
|
|
500
483
|
this._nodeAttributes.refresh({ icon: iconStyleRules });
|
|
501
484
|
this._ogmaNodeIcon = this._ogma.styles.addRule({
|
|
502
485
|
nodeAttributes: {
|
|
503
|
-
icon:
|
|
486
|
+
icon: (node) => {
|
|
504
487
|
if (node !== undefined) {
|
|
505
|
-
return
|
|
488
|
+
return this._nodeAttributes.icon(node.getData()).icon;
|
|
506
489
|
}
|
|
507
490
|
},
|
|
508
|
-
image:
|
|
491
|
+
image: (node) => {
|
|
509
492
|
if (node !== undefined) {
|
|
510
|
-
return
|
|
493
|
+
return this._nodeAttributes.icon(node.getData()).image;
|
|
511
494
|
}
|
|
512
495
|
}
|
|
513
496
|
},
|
|
@@ -518,21 +501,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
518
501
|
this._nodeAttributes.refresh({ icon: iconStyleRules });
|
|
519
502
|
this._ogmaNodeIcon.refresh();
|
|
520
503
|
}
|
|
521
|
-
}
|
|
504
|
+
}
|
|
522
505
|
/**
|
|
523
506
|
* Create / refresh an ogma rule for node sizes
|
|
524
507
|
*
|
|
525
508
|
* @param {Array<any>} sizeStyleRules
|
|
526
509
|
*/
|
|
527
|
-
|
|
528
|
-
var _this = this;
|
|
510
|
+
refreshNodeSize(sizeStyleRules) {
|
|
529
511
|
if (!tools_1.Tools.isDefined(this._ogmaNodeSize)) {
|
|
530
512
|
this._nodeAttributes.refresh({ size: sizeStyleRules });
|
|
531
513
|
this._ogmaNodeSize = this._ogma.styles.addRule({
|
|
532
514
|
nodeAttributes: {
|
|
533
|
-
radius:
|
|
515
|
+
radius: (node) => {
|
|
534
516
|
if (node !== undefined) {
|
|
535
|
-
return
|
|
517
|
+
return this._nodeAttributes.size(node.getData());
|
|
536
518
|
}
|
|
537
519
|
}
|
|
538
520
|
},
|
|
@@ -543,21 +525,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
543
525
|
this._nodeAttributes.refresh({ size: sizeStyleRules });
|
|
544
526
|
this._ogmaNodeSize.refresh();
|
|
545
527
|
}
|
|
546
|
-
}
|
|
528
|
+
}
|
|
547
529
|
/**
|
|
548
530
|
* Create / refresh an ogma rule for node images
|
|
549
531
|
*
|
|
550
532
|
* @param {Array<any>} shapeStyleRules
|
|
551
533
|
*/
|
|
552
|
-
|
|
553
|
-
var _this = this;
|
|
534
|
+
refreshNodeShape(shapeStyleRules) {
|
|
554
535
|
if (!tools_1.Tools.isDefined(this._ogmaNodeShape)) {
|
|
555
536
|
this._nodeAttributes.refresh({ shape: shapeStyleRules });
|
|
556
537
|
this._ogmaNodeShape = this._ogma.styles.addRule({
|
|
557
538
|
nodeAttributes: {
|
|
558
|
-
shape:
|
|
539
|
+
shape: (node) => {
|
|
559
540
|
if (node !== undefined) {
|
|
560
|
-
return
|
|
541
|
+
return this._nodeAttributes.shape(node.getData());
|
|
561
542
|
}
|
|
562
543
|
}
|
|
563
544
|
},
|
|
@@ -568,19 +549,18 @@ var StylesViz = /** @class */ (function () {
|
|
|
568
549
|
this._nodeAttributes.refresh({ shape: shapeStyleRules });
|
|
569
550
|
this._ogmaNodeShape.refresh();
|
|
570
551
|
}
|
|
571
|
-
}
|
|
552
|
+
}
|
|
572
553
|
/**
|
|
573
554
|
* Create / refresh an ogma rule for edge colors
|
|
574
555
|
*/
|
|
575
|
-
|
|
576
|
-
var _this = this;
|
|
556
|
+
refreshEdgeColors(colorStyleRules) {
|
|
577
557
|
if (!tools_1.Tools.isDefined(this._ogmaEdgeColor)) {
|
|
578
558
|
this._edgeAttributes.refresh({ color: colorStyleRules });
|
|
579
559
|
this._ogmaEdgeColor = this._ogma.styles.addRule({
|
|
580
560
|
edgeAttributes: {
|
|
581
|
-
color:
|
|
561
|
+
color: (edge) => {
|
|
582
562
|
if (edge !== undefined) {
|
|
583
|
-
return
|
|
563
|
+
return this._edgeAttributes.color(edge.getData());
|
|
584
564
|
}
|
|
585
565
|
}
|
|
586
566
|
},
|
|
@@ -591,21 +571,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
591
571
|
this._edgeAttributes.refresh({ color: colorStyleRules });
|
|
592
572
|
this._ogmaEdgeColor.refresh();
|
|
593
573
|
}
|
|
594
|
-
}
|
|
574
|
+
}
|
|
595
575
|
/**
|
|
596
576
|
* Create / refresh an ogma rule for edge width
|
|
597
577
|
*
|
|
598
578
|
* @param {Array<LKStyleRule>} widthStyleRules
|
|
599
579
|
*/
|
|
600
|
-
|
|
601
|
-
var _this = this;
|
|
580
|
+
refreshEdgeWidth(widthStyleRules) {
|
|
602
581
|
if (!tools_1.Tools.isDefined(this._ogmaEdgeWidth)) {
|
|
603
582
|
this._edgeAttributes.refresh({ width: widthStyleRules });
|
|
604
583
|
this._ogmaEdgeWidth = this._ogma.styles.addRule({
|
|
605
584
|
edgeAttributes: {
|
|
606
|
-
width:
|
|
585
|
+
width: (edge) => {
|
|
607
586
|
if (edge !== undefined) {
|
|
608
|
-
return
|
|
587
|
+
return this._edgeAttributes.width(edge.getData());
|
|
609
588
|
}
|
|
610
589
|
}
|
|
611
590
|
},
|
|
@@ -618,21 +597,20 @@ var StylesViz = /** @class */ (function () {
|
|
|
618
597
|
this._edgeAttributes.refresh({ width: widthStyleRules });
|
|
619
598
|
this._ogmaEdgeWidth.refresh();
|
|
620
599
|
}
|
|
621
|
-
}
|
|
600
|
+
}
|
|
622
601
|
/**
|
|
623
602
|
* Create / refresh an ogma rule for edge width
|
|
624
603
|
*
|
|
625
604
|
* @param {Array<LKStyleRule>} shapeStyleRules
|
|
626
605
|
*/
|
|
627
|
-
|
|
628
|
-
var _this = this;
|
|
606
|
+
refreshEdgeShape(shapeStyleRules) {
|
|
629
607
|
if (!tools_1.Tools.isDefined(this._ogmaEdgeShape)) {
|
|
630
608
|
this._edgeAttributes.refresh({ shape: shapeStyleRules });
|
|
631
609
|
this._ogmaEdgeShape = this._ogma.styles.addRule({
|
|
632
610
|
edgeAttributes: {
|
|
633
|
-
shape:
|
|
611
|
+
shape: (edge) => {
|
|
634
612
|
if (edge !== undefined) {
|
|
635
|
-
return
|
|
613
|
+
return this._edgeAttributes.shape(edge.getData());
|
|
636
614
|
}
|
|
637
615
|
}
|
|
638
616
|
},
|
|
@@ -643,8 +621,7 @@ var StylesViz = /** @class */ (function () {
|
|
|
643
621
|
this._edgeAttributes.refresh({ shape: shapeStyleRules });
|
|
644
622
|
this._ogmaEdgeShape.refresh();
|
|
645
623
|
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
}());
|
|
624
|
+
}
|
|
625
|
+
}
|
|
649
626
|
exports.StylesViz = StylesViz;
|
|
650
627
|
//# sourceMappingURL=styles.js.map
|