aframe-babia-components 1.2.2 → 1.2.3
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/components/filters/babia-selector.js +256 -79
- package/components/filters/babia-treebuilder.js +1 -2
- package/components/geometries/babia-cyl.js +180 -0
- package/components/others/assets/tooltip.png +0 -0
- package/components/others/babia-camera.js +195 -0
- package/components/others/babia-controls.js +56 -31
- package/components/others/babia-navigator.js +55 -49
- package/components/others/babia-range-selector.js +208 -0
- package/components/others/babia-slider.js +36 -8
- package/components/others/babia-ui.js +246 -73
- package/components/others/common.js +60 -73
- package/components/queriers/babia-querycsv.js +96 -0
- package/components/queriers/babia-queryes.js +203 -132
- package/components/visualizers/babia-bars.js +4 -35
- package/components/visualizers/babia-barsmap.js +2 -30
- package/components/visualizers/babia-boats.js +92 -100
- package/components/visualizers/babia-bubbles.js +9 -26
- package/components/visualizers/babia-cyls.js +197 -201
- package/components/visualizers/babia-cylsmap.js +171 -241
- package/components/visualizers/babia-doughnut.js +2 -28
- package/components/visualizers/babia-network.js +191 -124
- package/components/visualizers/babia-pie.js +2 -30
- package/dist/aframe-babia-components.js +21678 -19529
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +10 -4
- package/docs/APIs/DATAMANAGEMENT.md +7 -0
- package/docs/APIs/OTHERS.md +27 -0
- package/docs/APIs/QUERIERS.md +16 -0
- package/docs/RELEASE_NOTES.md +32 -21
- package/docs/Tutorials/multiuser.md +47 -2
- package/examples/assets/door/New Bitmap Image.jpg +0 -0
- package/examples/assets/door/door.mtl +26 -0
- package/examples/assets/door/door.obj +6927 -0
- package/examples/assets/popups/0.png +0 -0
- package/examples/assets/popups/1.png +0 -0
- package/examples/assets/popups/10.png +0 -0
- package/examples/assets/popups/2.png +0 -0
- package/examples/assets/popups/3.png +0 -0
- package/examples/assets/popups/4.png +0 -0
- package/examples/assets/popups/5.png +0 -0
- package/examples/assets/popups/6.png +0 -0
- package/examples/assets/popups/7.png +0 -0
- package/examples/assets/popups/8.png +0 -0
- package/examples/assets/popups/9.png +0 -0
- package/examples/assets/popups/close.jpg +0 -0
- package/examples/assets/popups/info.jpg +0 -0
- package/examples/assets/textures/brownwall.png +0 -0
- package/examples/assets/textures/concrete.png +0 -0
- package/examples/assets/textures/white-wall-texture.jpg +0 -0
- package/examples/charts/cyls/index.html +13 -4
- package/examples/charts/cyls/primitive.html +76 -0
- package/examples/charts/cylsmap/index.html +14 -5
- package/examples/charts_querier/bars_querier/data.csv +10 -0
- package/examples/charts_querier/bars_querier/index_csv.html +80 -0
- package/examples/dashboard/chaoss-dashboards.html +259 -0
- package/examples/dashboard/chaoss-issues.html +248 -0
- package/examples/dashboard/chaoss-pr.html +248 -0
- package/examples/dashboard/index.html +247 -0
- package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
- package/examples/dashboard/issues_queries/issues.json +117 -0
- package/examples/dashboard/issues_queries/median-open-time.json +123 -0
- package/examples/dashboard/issues_queries/organizations.json +130 -0
- package/examples/dashboard/issues_queries/projects.json +130 -0
- package/examples/dashboard/issues_queries/repositories.json +130 -0
- package/examples/dashboard/issues_queries/status.json +107 -0
- package/examples/dashboard/issues_queries/submitter.json +125 -0
- package/examples/dashboard/issues_queries/submitters.json +113 -0
- package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
- package/examples/dashboard/pullrequests_queries/projects.json +130 -0
- package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
- package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
- package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
- package/examples/dashboard/pullrequests_queries/status.json +107 -0
- package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
- package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
- package/examples/dashboard/range.html +88 -0
- package/examples/dashboard/template.html +136 -0
- package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
- package/examples/multi_bars/data.json +14 -0
- package/examples/multi_bars/data2.json +15 -0
- package/examples/multi_bars/data3.json +23 -0
- package/examples/multi_bars/easyrtc.js +11984 -0
- package/examples/multi_bars/index.html +97 -0
- package/examples/multi_bars/index1.html +111 -0
- package/examples/multi_bars/index2.html +102 -0
- package/examples/multi_bars/index3.html +104 -0
- package/examples/multi_boats/data3.json +174 -0
- package/examples/multi_boats/data4.json +192 -0
- package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
- package/examples/multi_boats/jetuml.html +124 -115
- package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
- package/examples/multi_boats/only_queryjson.html +132 -0
- package/examples/multi_boats/only_queryjson2.html +167 -0
- package/examples/multi_boats/only_queryjson3.html +165 -0
- package/examples/multi_boats/queryjson_treebuilder.html +132 -0
- package/examples/multi_boats/with_selector.html +121 -111
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/ui/network/data.json +123 -0
- package/examples/ui/network/links.json +13 -0
- package/examples/ui/network/network.html +75 -0
- package/examples/ui/network/network_nodes_links.html +82 -0
- package/examples/ui/network/nodes.json +12 -0
- package/index.html +69 -3
- package/index.js +6 -1
- package/package.json +4 -3
- package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
- package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
- package/tests/screenshots/other_snapshots.js/template.png +0 -0
- package/tests/ui.js +7 -0
- package/webpack.common.js +1 -1
- package/webpack.devnossl.js +16 -0
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -79
|
@@ -26,6 +26,7 @@ SOFTWARE.
|
|
|
26
26
|
|
|
27
27
|
let findProdComponent = require('../others/common').findProdComponent;
|
|
28
28
|
let parseJson = require('../others/common').parseJson;
|
|
29
|
+
const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
29
30
|
|
|
30
31
|
/* global AFRAME */
|
|
31
32
|
|
|
@@ -187,7 +188,19 @@ AFRAME.registerComponent('babia-network', {
|
|
|
187
188
|
return this;
|
|
188
189
|
},
|
|
189
190
|
|
|
191
|
+
/**
|
|
192
|
+
* List of visualization properties
|
|
193
|
+
*/
|
|
194
|
+
visProperties: { 'nodes': ['nodeId'],
|
|
195
|
+
'links0': ['linkId'],
|
|
196
|
+
'links1': ['linkSource', 'linkTarget']},
|
|
197
|
+
|
|
190
198
|
init: function () {
|
|
199
|
+
this.isFirstTimeNodes = true;
|
|
200
|
+
this.isFirstTimeLinks = true;
|
|
201
|
+
|
|
202
|
+
this.notiBuffer = new NotiBuffer();
|
|
203
|
+
|
|
191
204
|
let state = this.state = {}; // Internal state
|
|
192
205
|
|
|
193
206
|
// Get camera dom element and attach fixed view elements to camera
|
|
@@ -283,16 +296,22 @@ AFRAME.registerComponent('babia-network', {
|
|
|
283
296
|
this.notiBufferId = this.linksProdComponent.notiBuffer
|
|
284
297
|
.register(this.processLinks.bind(this))
|
|
285
298
|
}
|
|
286
|
-
}
|
|
299
|
+
}
|
|
287
300
|
|
|
288
301
|
// If changed whatever, re-print with the current data
|
|
289
|
-
if (elData !== oldData) {
|
|
290
|
-
if (
|
|
291
|
-
let _data = parseJson(
|
|
292
|
-
this.processData(_data)
|
|
293
|
-
} else if (
|
|
294
|
-
|
|
295
|
-
|
|
302
|
+
else if (elData !== oldData) {
|
|
303
|
+
if (this.newData){
|
|
304
|
+
let _data = parseJson(this.newData);
|
|
305
|
+
this.processData(_data, true)
|
|
306
|
+
} else if (this.newNodes){
|
|
307
|
+
if (elData.linkSource != oldData.linkSource || elData.linkTarget != oldData.linkTarget) {
|
|
308
|
+
let _links = parseJson(this.newLinks);
|
|
309
|
+
this.processLinks(_links, true)
|
|
310
|
+
} else {
|
|
311
|
+
let _nodes = parseJson(this.newNodes);
|
|
312
|
+
this.processNodes(_nodes, true)
|
|
313
|
+
}
|
|
314
|
+
|
|
296
315
|
}
|
|
297
316
|
}
|
|
298
317
|
}
|
|
@@ -368,11 +387,26 @@ AFRAME.registerComponent('babia-network', {
|
|
|
368
387
|
* Where the data is gonna be stored
|
|
369
388
|
*/
|
|
370
389
|
newData: undefined,
|
|
390
|
+
newNodes: undefined,
|
|
391
|
+
newLinks: undefined,
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Boolean to know if it's first time for getting the ui fields
|
|
396
|
+
*/
|
|
397
|
+
isFirstTimeNodes: undefined,
|
|
398
|
+
isFirstTimeLinks: undefined,
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Store the fields that we need to show in the ui and not the rest
|
|
402
|
+
*/
|
|
403
|
+
nodeFields: undefined,
|
|
404
|
+
linkFields: undefined,
|
|
371
405
|
|
|
372
406
|
/**
|
|
373
407
|
* Where the current data is stored
|
|
374
408
|
*/
|
|
375
|
-
|
|
409
|
+
currentData: undefined,
|
|
376
410
|
|
|
377
411
|
/**
|
|
378
412
|
* Where the metadata is gonna be stored
|
|
@@ -386,8 +420,16 @@ AFRAME.registerComponent('babia-network', {
|
|
|
386
420
|
/*
|
|
387
421
|
* Update chart
|
|
388
422
|
*/
|
|
389
|
-
updateChart: function (
|
|
423
|
+
updateChart: function (nodes_links, self) {
|
|
390
424
|
if (self.currentData){
|
|
425
|
+
let elData = [];
|
|
426
|
+
for (let attr in this.data){
|
|
427
|
+
elData[attr] = this.data[attr]
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
elData.nodes = nodes_links.nodes;
|
|
431
|
+
elData.links = nodes_links.links;
|
|
432
|
+
|
|
391
433
|
let diff = AFRAME.utils.diff(elData, self.currentData);
|
|
392
434
|
let fgProps = [
|
|
393
435
|
'jsonUrl',
|
|
@@ -459,79 +501,74 @@ AFRAME.registerComponent('babia-network', {
|
|
|
459
501
|
/*
|
|
460
502
|
* Process data obtained from producer
|
|
461
503
|
*/
|
|
462
|
-
processData: function (_data) {
|
|
504
|
+
processData: function (_data, newData) {
|
|
463
505
|
console.log("processData", this);
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
this.data = elData
|
|
506
|
+
if (this.newData != _data || newData){
|
|
507
|
+
this.newData = _data;
|
|
508
|
+
let nodes_links = this.elDataFromData(_data);
|
|
468
509
|
this.babiaMetadata = { id: this.babiaMetadata.id++ };
|
|
469
510
|
console.log("Generating network...")
|
|
470
|
-
this.updateChart(
|
|
511
|
+
this.updateChart(nodes_links, this)
|
|
512
|
+
this.notiBuffer.set(_data)
|
|
513
|
+
}
|
|
471
514
|
},
|
|
472
515
|
|
|
473
|
-
processNodes: function (nodes){
|
|
516
|
+
processNodes: function (nodes, forceProcess){
|
|
474
517
|
console.log("processNodes", this);
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
this.
|
|
484
|
-
|
|
518
|
+
if (this.newNodes != nodes || forceProcess){
|
|
519
|
+
this.newNodes = nodes;
|
|
520
|
+
let nodes_links = this.elDataFromNodesAndLinks(nodes, this.newLinks)
|
|
521
|
+
|
|
522
|
+
if (!nodes_links){
|
|
523
|
+
if (this.data.links) {
|
|
524
|
+
let _links = parseJson(this.data.links);
|
|
525
|
+
this.processLinks(_links)
|
|
526
|
+
} else if (this.data.linksFrom){
|
|
527
|
+
this.babiaMetadata = { id: this.babiaMetadata.id++ }
|
|
528
|
+
console.log("Generating network...")
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
485
531
|
this.babiaMetadata = { id: this.babiaMetadata.id++ }
|
|
486
532
|
console.log("Generating network...")
|
|
533
|
+
this.updateChart(nodes_links, this)
|
|
534
|
+
this.notiBuffer.set({'nodes': nodes_links.nodes, 'links': nodes_links.links})
|
|
487
535
|
}
|
|
488
|
-
} else {
|
|
489
|
-
this.data = elData
|
|
490
|
-
this.babiaMetadata = { id: this.babiaMetadata.id++ }
|
|
491
|
-
console.log("Generating network...")
|
|
492
|
-
this.updateChart(elData, this)
|
|
493
536
|
}
|
|
494
|
-
|
|
495
537
|
},
|
|
496
538
|
|
|
497
|
-
processLinks: function (
|
|
539
|
+
processLinks: function (_links, forceProcess){
|
|
498
540
|
console.log("processLinks", this);
|
|
499
|
-
let
|
|
500
|
-
if (
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
} else if (this.data.nodesFrom){
|
|
541
|
+
let links = parseJson(_links);
|
|
542
|
+
if (this.newLinks != links || forceProcess){
|
|
543
|
+
this.newLinks = links;
|
|
544
|
+
let nodes_links = this.elDataFromNodesAndLinks(this.newNodes, links)
|
|
545
|
+
if (!nodes_links){
|
|
546
|
+
if (this.data.nodes) {
|
|
547
|
+
let _nodes = parseJson(this.data.nodes);
|
|
548
|
+
this.processNodes(_nodes)
|
|
549
|
+
} else if (this.data.nodesFrom){
|
|
550
|
+
this.babiaMetadata = { id: this.babiaMetadata.id++ }
|
|
551
|
+
console.log("Generating network...")
|
|
552
|
+
}
|
|
553
|
+
} else {
|
|
513
554
|
this.babiaMetadata = { id: this.babiaMetadata.id++ }
|
|
514
555
|
console.log("Generating network...")
|
|
556
|
+
this.updateChart(nodes_links, this)
|
|
557
|
+
this.notiBuffer.set({'nodes': nodes_links.nodes, 'links': nodes_links.links})
|
|
515
558
|
}
|
|
516
|
-
} else {
|
|
517
|
-
this.data = elData
|
|
518
|
-
this.babiaMetadata = { id: this.babiaMetadata.id++ }
|
|
519
|
-
console.log("Generating network...")
|
|
520
|
-
this.updateChart(elData, this)
|
|
521
559
|
}
|
|
522
560
|
},
|
|
523
561
|
// Format from data to nodes and links
|
|
524
|
-
elDataFromData: function(
|
|
562
|
+
elDataFromData: function(data){
|
|
525
563
|
let nodes = [];
|
|
526
564
|
let links = [];
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
const
|
|
530
|
-
const
|
|
531
|
-
const
|
|
532
|
-
const
|
|
533
|
-
const
|
|
534
|
-
const linkLabel = elData.linkLabel;
|
|
565
|
+
|
|
566
|
+
const nodeId = this.data.nodeId;
|
|
567
|
+
const linkId = this.data.linkId;
|
|
568
|
+
const nodeVal = this.data.nodeVal;
|
|
569
|
+
const source = this.data.linkSource;
|
|
570
|
+
const target = this.data.linkTarget;
|
|
571
|
+
const linkLabel = this.data.linkLabel;
|
|
535
572
|
|
|
536
573
|
data.forEach(element => {
|
|
537
574
|
let node = {};
|
|
@@ -539,9 +576,11 @@ AFRAME.registerComponent('babia-network', {
|
|
|
539
576
|
Object.keys(element).forEach(function (k) {
|
|
540
577
|
if (k === nodeId) {
|
|
541
578
|
node[nodeId] = element[k];
|
|
542
|
-
}
|
|
579
|
+
}
|
|
580
|
+
if (k === linkId) {
|
|
543
581
|
node.linkId = element[k];
|
|
544
|
-
}
|
|
582
|
+
}
|
|
583
|
+
if (k === nodeVal) {
|
|
545
584
|
node[nodeVal] = element[k];
|
|
546
585
|
}
|
|
547
586
|
});
|
|
@@ -561,6 +600,7 @@ AFRAME.registerComponent('babia-network', {
|
|
|
561
600
|
})
|
|
562
601
|
if (!linkExists) {
|
|
563
602
|
let newLink = {}
|
|
603
|
+
//newLink[linkId] = firstNode[linkId]
|
|
564
604
|
newLink[linkLabel] = firstNode[linkLabel]
|
|
565
605
|
newLink[source] = firstNode[nodeId]
|
|
566
606
|
newLink[target] = secondNode[nodeId]
|
|
@@ -568,6 +608,7 @@ AFRAME.registerComponent('babia-network', {
|
|
|
568
608
|
}
|
|
569
609
|
} else {
|
|
570
610
|
let newLink = {}
|
|
611
|
+
//newLink[linkId] = firstNode[linkId]
|
|
571
612
|
newLink[linkLabel] = firstNode[linkLabel]
|
|
572
613
|
newLink[source] = firstNode[nodeId]
|
|
573
614
|
newLink[target] = secondNode[nodeId]
|
|
@@ -578,48 +619,67 @@ AFRAME.registerComponent('babia-network', {
|
|
|
578
619
|
})
|
|
579
620
|
});
|
|
580
621
|
|
|
581
|
-
|
|
582
|
-
elData.links = links;
|
|
583
|
-
|
|
584
|
-
return elData;
|
|
622
|
+
return {nodes: nodes, links: links};
|
|
585
623
|
},
|
|
586
624
|
|
|
587
625
|
// Format nodes and links
|
|
588
626
|
|
|
589
|
-
elDataFromNodesAndLinks: function(
|
|
590
|
-
let nodes = elData.nodes;
|
|
591
|
-
let links = elData.links;
|
|
592
|
-
const nodeId = elData.nodeId;
|
|
593
|
-
const nodeVal = elData.nodeVal;
|
|
594
|
-
const source = elData.linkSource;
|
|
595
|
-
const target = elData.linkTarget;
|
|
596
|
-
|
|
627
|
+
elDataFromNodesAndLinks: function(nodes, links) {
|
|
597
628
|
if (!Array.isArray(nodes) || !Array.isArray(links)) {
|
|
598
629
|
// Either nodes or links are not ready yet
|
|
599
630
|
return false
|
|
600
631
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
632
|
+
|
|
633
|
+
if (this.isFirstTimeNodes){
|
|
634
|
+
this.nodeFields = []
|
|
635
|
+
Object.keys(nodes[0]).forEach((k) => {
|
|
636
|
+
this.nodeFields.push(k)
|
|
637
|
+
})
|
|
638
|
+
this.isFirstTimeNodes = false;
|
|
639
|
+
}
|
|
640
|
+
if (this.isFirstTimeLinks){
|
|
641
|
+
this.linkFields = []
|
|
642
|
+
Object.keys(links[0]).forEach((k) => {
|
|
643
|
+
this.linkFields.push(k)
|
|
644
|
+
})
|
|
645
|
+
this.isFirstTimeLinks = false;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (typeof(links[0].source) === 'object') {
|
|
649
|
+
links.forEach ((link) => {
|
|
650
|
+
link.source = link.source[this.data.nodeId];
|
|
651
|
+
link.target = link.target[this.data.nodeId];
|
|
652
|
+
})
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
let _nodes = [];
|
|
656
|
+
nodes.forEach((node) => {
|
|
657
|
+
let _node = {};
|
|
658
|
+
Object.keys(node).forEach((k) => {
|
|
659
|
+
for (let f in this.nodeFields){
|
|
660
|
+
if (k == this.nodeFields[f]){
|
|
661
|
+
_node[k] = node[k]
|
|
662
|
+
}
|
|
607
663
|
}
|
|
608
|
-
})
|
|
664
|
+
})
|
|
665
|
+
_nodes.push(_node)
|
|
609
666
|
})
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
667
|
+
|
|
668
|
+
let _links = [];
|
|
669
|
+
links.forEach((link) => {
|
|
670
|
+
let _link = {};
|
|
671
|
+
Object.keys(link).forEach((k) => {
|
|
672
|
+
for (let f in this.linkFields){
|
|
673
|
+
if (k == this.linkFields[f] && k != this.data.linkId){
|
|
674
|
+
_link[k] = link[k]
|
|
675
|
+
}
|
|
616
676
|
}
|
|
617
677
|
})
|
|
678
|
+
_links.push(_link)
|
|
679
|
+
|
|
618
680
|
})
|
|
619
|
-
elData.nodes = nodes;
|
|
620
|
-
elData.links = links;
|
|
621
681
|
|
|
622
|
-
return
|
|
682
|
+
return {nodes: _nodes, links: _links};
|
|
623
683
|
},
|
|
624
684
|
|
|
625
685
|
showLegend: function (nodeThree, node, nodeLabel, scale) {
|
|
@@ -628,7 +688,9 @@ AFRAME.registerComponent('babia-network', {
|
|
|
628
688
|
let radius = nodeThree.geometry.boundingSphere.radius
|
|
629
689
|
let sceneEl = document.querySelector('a-scene');
|
|
630
690
|
this.legend = generateLegend(node, nodeLabel, worldPosition, radius, scale);
|
|
631
|
-
|
|
691
|
+
if (this.legend){
|
|
692
|
+
sceneEl.appendChild(this.legend);
|
|
693
|
+
}
|
|
632
694
|
},
|
|
633
695
|
|
|
634
696
|
showLinkLegend: function(linkThree, link, linkLabel, scale) {
|
|
@@ -655,7 +717,9 @@ AFRAME.registerComponent('babia-network', {
|
|
|
655
717
|
|
|
656
718
|
let sceneEl = document.querySelector('a-scene');
|
|
657
719
|
this.legend = generateLinkLegend(link, linkLabel, worldPosition, radius, scale);
|
|
658
|
-
|
|
720
|
+
if (this.legend){
|
|
721
|
+
sceneEl.appendChild(this.legend);
|
|
722
|
+
}
|
|
659
723
|
},
|
|
660
724
|
|
|
661
725
|
removeLegend: function() {
|
|
@@ -668,40 +732,42 @@ AFRAME.registerComponent('babia-network', {
|
|
|
668
732
|
|
|
669
733
|
function generateLegend(node, nodeLabel, nodePosition, radius, scale) {
|
|
670
734
|
let text = node[nodeLabel];
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
735
|
+
if (text) {
|
|
736
|
+
let width = 2;
|
|
737
|
+
let x = 3;
|
|
738
|
+
let y = 3;
|
|
739
|
+
let z = 3;
|
|
740
|
+
if (text.length > 16)
|
|
741
|
+
width = text.length / 8;
|
|
742
|
+
if(scale){
|
|
743
|
+
x = x * scale.x;
|
|
744
|
+
y = y * scale.y;
|
|
745
|
+
z = z * scale.z;
|
|
746
|
+
radius = (radius + 3) * scale.y;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
let entity = document.createElement('a-plane');
|
|
750
|
+
entity.setAttribute('position', {x: nodePosition.x, y: nodePosition.y + radius, z: nodePosition.z})
|
|
751
|
+
entity.setAttribute('babia-lookat', "[camera]");
|
|
752
|
+
entity.setAttribute('width', width);
|
|
753
|
+
entity.setAttribute('height', '1');
|
|
754
|
+
entity.setAttribute('color', 'white');
|
|
755
|
+
entity.setAttribute('scale', {x: x, y: y, z: z})
|
|
756
|
+
entity.setAttribute('text', {
|
|
757
|
+
'value': node[nodeLabel],
|
|
758
|
+
'align': 'center',
|
|
759
|
+
'width': 6,
|
|
760
|
+
'color': 'black'
|
|
761
|
+
});
|
|
762
|
+
entity.classList.add("babiaxrLegend")
|
|
763
|
+
return entity;
|
|
764
|
+
}
|
|
700
765
|
}
|
|
701
766
|
|
|
702
767
|
function generateLinkLegend(link, linkLabel, linkPosition, radius, scale) {
|
|
703
768
|
let text = link[linkLabel];
|
|
704
|
-
|
|
769
|
+
if (text){
|
|
770
|
+
let width = 2;
|
|
705
771
|
let x = 3;
|
|
706
772
|
let y = 3;
|
|
707
773
|
let z = 3;
|
|
@@ -729,6 +795,7 @@ function generateLinkLegend(link, linkLabel, linkPosition, radius, scale) {
|
|
|
729
795
|
});
|
|
730
796
|
entity.classList.add("babiaxrLegend")
|
|
731
797
|
return entity;
|
|
798
|
+
}
|
|
732
799
|
}
|
|
733
800
|
|
|
734
801
|
function setCursor() {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
let findProdComponent = require('../others/common').findProdComponent;
|
|
2
1
|
let updateTitle = require('../others/common').updateTitle;
|
|
3
|
-
let parseJson = require('../others/common').parseJson;
|
|
4
2
|
const colors = require('../others/common').colors;
|
|
3
|
+
let updateFunction = require('../others/common').updateFunction;
|
|
5
4
|
|
|
6
5
|
const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
7
6
|
|
|
@@ -50,34 +49,7 @@ AFRAME.registerComponent('babia-pie', {
|
|
|
50
49
|
*/
|
|
51
50
|
|
|
52
51
|
update: function (oldData) {
|
|
53
|
-
|
|
54
|
-
let el = this.el;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Update or create chart component
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
if (data.data && oldData.data !== data.data) {
|
|
61
|
-
let _data = parseJson(data.data);
|
|
62
|
-
this.processData(_data);
|
|
63
|
-
} else if (data.from !== oldData.from) {
|
|
64
|
-
this.slice_array = []
|
|
65
|
-
// Unregister from old producer
|
|
66
|
-
if (this.prodComponent) {
|
|
67
|
-
this.prodComponent.notiBuffer.unregister(this.notiBufferId)
|
|
68
|
-
};
|
|
69
|
-
this.prodComponent = findProdComponent (data, el)
|
|
70
|
-
if (this.prodComponent.notiBuffer) {
|
|
71
|
-
this.notiBufferId = this.prodComponent.notiBuffer
|
|
72
|
-
.register(this.processData.bind(this))
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// If changed whatever, re-print with the current data
|
|
76
|
-
else if (data !== oldData && this.newData) {
|
|
77
|
-
this.slice_array = []
|
|
78
|
-
this.processData(this.newData);
|
|
79
|
-
}
|
|
80
|
-
|
|
52
|
+
updateFunction(this, oldData)
|
|
81
53
|
},
|
|
82
54
|
|
|
83
55
|
/**
|