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.
Files changed (118) hide show
  1. package/components/filters/babia-selector.js +256 -79
  2. package/components/filters/babia-treebuilder.js +1 -2
  3. package/components/geometries/babia-cyl.js +180 -0
  4. package/components/others/assets/tooltip.png +0 -0
  5. package/components/others/babia-camera.js +195 -0
  6. package/components/others/babia-controls.js +56 -31
  7. package/components/others/babia-navigator.js +55 -49
  8. package/components/others/babia-range-selector.js +208 -0
  9. package/components/others/babia-slider.js +36 -8
  10. package/components/others/babia-ui.js +246 -73
  11. package/components/others/common.js +60 -73
  12. package/components/queriers/babia-querycsv.js +96 -0
  13. package/components/queriers/babia-queryes.js +203 -132
  14. package/components/visualizers/babia-bars.js +4 -35
  15. package/components/visualizers/babia-barsmap.js +2 -30
  16. package/components/visualizers/babia-boats.js +92 -100
  17. package/components/visualizers/babia-bubbles.js +9 -26
  18. package/components/visualizers/babia-cyls.js +197 -201
  19. package/components/visualizers/babia-cylsmap.js +171 -241
  20. package/components/visualizers/babia-doughnut.js +2 -28
  21. package/components/visualizers/babia-network.js +191 -124
  22. package/components/visualizers/babia-pie.js +2 -30
  23. package/dist/aframe-babia-components.js +21678 -19529
  24. package/dist/aframe-babia-components.min.js +7 -1
  25. package/dist/aframe-babia-components.min.js.map +1 -1
  26. package/docs/APIs/CHARTS.md +10 -4
  27. package/docs/APIs/DATAMANAGEMENT.md +7 -0
  28. package/docs/APIs/OTHERS.md +27 -0
  29. package/docs/APIs/QUERIERS.md +16 -0
  30. package/docs/RELEASE_NOTES.md +32 -21
  31. package/docs/Tutorials/multiuser.md +47 -2
  32. package/examples/assets/door/New Bitmap Image.jpg +0 -0
  33. package/examples/assets/door/door.mtl +26 -0
  34. package/examples/assets/door/door.obj +6927 -0
  35. package/examples/assets/popups/0.png +0 -0
  36. package/examples/assets/popups/1.png +0 -0
  37. package/examples/assets/popups/10.png +0 -0
  38. package/examples/assets/popups/2.png +0 -0
  39. package/examples/assets/popups/3.png +0 -0
  40. package/examples/assets/popups/4.png +0 -0
  41. package/examples/assets/popups/5.png +0 -0
  42. package/examples/assets/popups/6.png +0 -0
  43. package/examples/assets/popups/7.png +0 -0
  44. package/examples/assets/popups/8.png +0 -0
  45. package/examples/assets/popups/9.png +0 -0
  46. package/examples/assets/popups/close.jpg +0 -0
  47. package/examples/assets/popups/info.jpg +0 -0
  48. package/examples/assets/textures/brownwall.png +0 -0
  49. package/examples/assets/textures/concrete.png +0 -0
  50. package/examples/assets/textures/white-wall-texture.jpg +0 -0
  51. package/examples/charts/cyls/index.html +13 -4
  52. package/examples/charts/cyls/primitive.html +76 -0
  53. package/examples/charts/cylsmap/index.html +14 -5
  54. package/examples/charts_querier/bars_querier/data.csv +10 -0
  55. package/examples/charts_querier/bars_querier/index_csv.html +80 -0
  56. package/examples/dashboard/chaoss-dashboards.html +259 -0
  57. package/examples/dashboard/chaoss-issues.html +248 -0
  58. package/examples/dashboard/chaoss-pr.html +248 -0
  59. package/examples/dashboard/index.html +247 -0
  60. package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
  61. package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
  62. package/examples/dashboard/issues_queries/issues.json +117 -0
  63. package/examples/dashboard/issues_queries/median-open-time.json +123 -0
  64. package/examples/dashboard/issues_queries/organizations.json +130 -0
  65. package/examples/dashboard/issues_queries/projects.json +130 -0
  66. package/examples/dashboard/issues_queries/repositories.json +130 -0
  67. package/examples/dashboard/issues_queries/status.json +107 -0
  68. package/examples/dashboard/issues_queries/submitter.json +125 -0
  69. package/examples/dashboard/issues_queries/submitters.json +113 -0
  70. package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
  71. package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
  72. package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
  73. package/examples/dashboard/pullrequests_queries/projects.json +130 -0
  74. package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
  75. package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
  76. package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
  77. package/examples/dashboard/pullrequests_queries/status.json +107 -0
  78. package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
  79. package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
  80. package/examples/dashboard/range.html +88 -0
  81. package/examples/dashboard/template.html +136 -0
  82. package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
  83. package/examples/multi_bars/data.json +14 -0
  84. package/examples/multi_bars/data2.json +15 -0
  85. package/examples/multi_bars/data3.json +23 -0
  86. package/examples/multi_bars/easyrtc.js +11984 -0
  87. package/examples/multi_bars/index.html +97 -0
  88. package/examples/multi_bars/index1.html +111 -0
  89. package/examples/multi_bars/index2.html +102 -0
  90. package/examples/multi_bars/index3.html +104 -0
  91. package/examples/multi_boats/data3.json +174 -0
  92. package/examples/multi_boats/data4.json +192 -0
  93. package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
  94. package/examples/multi_boats/jetuml.html +124 -115
  95. package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
  96. package/examples/multi_boats/only_queryjson.html +132 -0
  97. package/examples/multi_boats/only_queryjson2.html +167 -0
  98. package/examples/multi_boats/only_queryjson3.html +165 -0
  99. package/examples/multi_boats/queryjson_treebuilder.html +132 -0
  100. package/examples/multi_boats/with_selector.html +121 -111
  101. package/examples/multiuser/choose_avatar/index.html +18 -8
  102. package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
  103. package/examples/ui/network/data.json +123 -0
  104. package/examples/ui/network/links.json +13 -0
  105. package/examples/ui/network/network.html +75 -0
  106. package/examples/ui/network/network_nodes_links.html +82 -0
  107. package/examples/ui/network/nodes.json +12 -0
  108. package/index.html +69 -3
  109. package/index.js +6 -1
  110. package/package.json +4 -3
  111. package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
  112. package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
  113. package/tests/screenshots/other_snapshots.js/template.png +0 -0
  114. package/tests/ui.js +7 -0
  115. package/webpack.common.js +1 -1
  116. package/webpack.devnossl.js +16 -0
  117. package/.idea/vcs.xml +0 -6
  118. package/.idea/workspace.xml +0 -79
@@ -1,4 +1,5 @@
1
1
  let findProdComponent = require('../others/common').findProdComponent;
2
+ let updateFunction = require('../others/common').updateFunction;
2
3
 
3
4
  const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
4
5
 
@@ -32,7 +33,8 @@ AFRAME.registerComponent('babia-boats', {
32
33
  height_quarter_legend_title: { type: 'number', default: 12 },
33
34
  height_building_legend: { type: 'number', default: 0 },
34
35
  legend_scale: { type: 'number', default: 1 },
35
- field: { type: 'string', default: 'uid'},
36
+ legend_lookat: { type: 'string', default: "[camera]" },
37
+ field: { type: 'string', default: 'uid' },
36
38
  },
37
39
 
38
40
  /**
@@ -86,35 +88,9 @@ AFRAME.registerComponent('babia-boats', {
86
88
  */
87
89
 
88
90
  update: function (oldData) {
89
- let data = this.data;
90
- let el = this.el;
91
- if (!this.figures){
92
- this.figures = [];
93
- }
94
-
95
- // Highest priority to data
96
- if (data.data && oldData.data !== data.data) {
97
- // Get from the json or embedded
98
- let _data = JSON.parse(data.data);
99
- this.processData(_data);
100
- } else if (data.from !== oldData.from) {
101
- // Unregister for old treegenerator
102
- if (this.prodComponent) {
103
- this.prodComponent.notiBuffer.unregister(this.notiBufferId)
104
- };
105
- // Register for the new one
106
- this.prodComponent = findProdComponent(data, el)
107
- if (this.prodComponent.notiBuffer){
108
- this.notiBufferId = this.prodComponent.notiBuffer
109
- .register(this.processData.bind(this))
110
- }
111
- }
112
- // If changed whatever, re-print with the current data
113
- else if (data !== oldData && this.newData) {
114
- this.processData(this.newData)
115
- }
91
+ updateFunction(this, oldData)
116
92
  },
117
-
93
+
118
94
  /**
119
95
  * Called on each scene tick.
120
96
  */
@@ -135,17 +111,17 @@ AFRAME.registerComponent('babia-boats', {
135
111
  let t = { x: 0, y: 0, z: 0 };
136
112
 
137
113
  // when animation not finished, delete figures and opa 1 to inserted
138
- if (this.animation){
114
+ if (this.animation) {
139
115
  this.figures_del.forEach(figure => {
140
116
  let entity = document.getElementById(figure.id);
141
- if (entity){
117
+ if (entity) {
142
118
  entity.remove();
143
119
  }
144
120
  })
145
121
  this.figures_in.forEach(figure => {
146
122
  let entity = document.getElementById(figure.id);
147
- if (entity){
148
- setOpacity(entity, 1.0);
123
+ if (entity) {
124
+ setOpacity(entity, 1.0);
149
125
  }
150
126
  })
151
127
  this.setFigures(this.figures, t);
@@ -183,7 +159,7 @@ AFRAME.registerComponent('babia-boats', {
183
159
  this.el.firstChild.remove();
184
160
  this.drawElements(el, this.figures, t);
185
161
  } else {
186
- if (this.figures_old !== this.figures){
162
+ if (this.figures_old !== this.figures) {
187
163
  this.animation = true;
188
164
  this.start_time = Date.now();
189
165
  }
@@ -336,7 +312,7 @@ AFRAME.registerComponent('babia-boats', {
336
312
  if (this.data.area) {
337
313
  figure = {
338
314
  id: "boat-" + elements[i][this.data.field],
339
- name: elements[i][this.data.field],
315
+ name: (elements[i].name) ? elements[i].name : elements[i][this.data.field],
340
316
  posX: posX,
341
317
  posY: posY,
342
318
  width: Math.sqrt(element.area),
@@ -346,7 +322,7 @@ AFRAME.registerComponent('babia-boats', {
346
322
  } else {
347
323
  figure = {
348
324
  id: "boat-" + elements[i][this.data.field],
349
- name: elements[i][this.data.field],
325
+ name: (elements[i].name) ? elements[i].name : elements[i][this.data.field],
350
326
  posX: posX,
351
327
  posY: posY,
352
328
  width: element.width,
@@ -419,7 +395,7 @@ AFRAME.registerComponent('babia-boats', {
419
395
 
420
396
  let entity = this.createElement(figures[i], position);
421
397
  this.addEvents(entity, figures[i]);
422
-
398
+
423
399
  element.appendChild(entity);
424
400
  }
425
401
 
@@ -532,28 +508,30 @@ AFRAME.registerComponent('babia-boats', {
532
508
  entity = document.getElementById(figures[i].id);
533
509
  // Creating... (next ticks)
534
510
  if (figures[i].inserted) {
511
+
512
+ //TODO: This code increments the opacity in the animation part, but it adds several performance issues
535
513
  //Increment opacity
536
- let opa_inc = delta / this.duration;
537
- let opacity = parseFloat(entity.getAttribute('material').opacity);
538
- if (opacity + opa_inc < 1) {
539
- opacity += opa_inc;
540
- } else {
541
- opacity = 1.0;
542
- figures[i].inserted = false;
543
- }
544
- setOpacity(entity, opacity);
514
+ // let opa_inc = delta / this.duration;
515
+ // let opacity = parseFloat(entity.getAttribute('material').opacity);
516
+ // if (opacity + opa_inc < 1) {
517
+ // opacity += opa_inc;
518
+ // } else {
519
+ // opacity = 1.0;
520
+ // figures[i].inserted = false;
521
+ // }
522
+ //setOpacity(entity, opacity);
545
523
 
546
524
  // If animation stops before finish
547
525
  let cond = 'id=' + figures[i].id
548
- if (findIndex(self.figures_in, cond) < 0){
526
+ if (findIndex(self.figures_in, cond) < 0) {
549
527
  self.figures_in.push(figures[i])
550
528
  }
551
529
 
552
- } else {
530
+ } else {
553
531
  // find index in old_figures
554
532
  let cond = 'id=' + figures[i].id
555
533
  let index = findIndex(figures_old, cond)
556
- if (index < 0 ){
534
+ if (index < 0) {
557
535
  // encontrar el elemento que no esta en la escena con id y darle opacidad
558
536
  // y cambiar sus propiedades a la nueva si es necesario
559
537
  figures[i].inserted = true;
@@ -590,8 +568,11 @@ AFRAME.registerComponent('babia-boats', {
590
568
  let new_entity = this.createElement(figures[i], position);
591
569
  this.addEvents(new_entity, figures[i]);
592
570
 
593
- //Opacity 0
594
- setOpacity(new_entity, 0);
571
+ //TODO: bad perfomance when Opacity 0 at the beginning
572
+ //setOpacity(new_entity, 0);
573
+
574
+ // New building and quarter, it appears with 0.5 opacity
575
+ setOpacity(new_entity, 0.5);
595
576
 
596
577
  element.appendChild(new_entity);
597
578
  figures[i].inserted = true;
@@ -600,37 +581,42 @@ AFRAME.registerComponent('babia-boats', {
600
581
 
601
582
  // Delete figures
602
583
  let opa_dec = delta / this.duration;
603
- for (let i in figures_old){
584
+ for (let i in figures_old) {
604
585
  let deleted = false;
605
586
  let cond = 'id=' + figures_old[i].id
606
587
  let index = findIndex(figures, cond)
607
- if (index < 0){
608
- if (findIndex(self.figures_del, cond) < 0){
588
+ if (index < 0) {
589
+ if (findIndex(self.figures_del, cond) < 0) {
609
590
  self.figures_del.push(figures_old[i])
610
591
  }
611
592
  let entity_del = document.getElementById(figures_old[i].id);
612
- if (entity_del){
613
- let opacity = parseFloat(entity_del.getAttribute('material').opacity);
614
- if (opacity - opa_dec > 0) {
615
- opacity -= opa_dec;
616
- } else {
617
- opacity = 0.0;
618
- deleted = true;
619
- self.figures_del.pop(figures_old[i]);
620
- }
621
- setOpacity(entity_del, opacity);
622
- if (deleted) {
623
- entity_del.remove();
624
- }
593
+ if (entity_del) {
594
+
595
+ //TODO: Bad perfomance issue when changing dinamically the opacity, better to just make it non vissible
596
+ entity_del.object3D.visible = false
597
+ entity_del.remove();
598
+
599
+ // let opacity = parseFloat(entity_del.components.material.opacity);
600
+ // if (opacity - opa_dec > 0) {
601
+ // opacity -= opa_dec;
602
+ // } else {
603
+ // opacity = 0.0;
604
+ // deleted = true;
605
+ // self.figures_del.pop(figures_old[i]);
606
+ // }
607
+ // setOpacity(entity_del, opacity);
608
+ // if (deleted) {
609
+ // entity_del.remove();
610
+ // }
625
611
  }
626
612
  }
627
613
  }
628
614
  },
629
615
 
630
- setFigures: function (figures, translate){
616
+ setFigures: function (figures, translate) {
631
617
  figures.forEach(figure => {
632
618
  let entity = document.getElementById(figure.id);
633
- if (entity){
619
+ if (entity) {
634
620
  if (entity.getAttribute('width') != figure.width) {
635
621
  entity.setAttribute('width', figure.width);
636
622
  }
@@ -640,13 +626,18 @@ AFRAME.registerComponent('babia-boats', {
640
626
  if (entity.getAttribute('depth') != figure.depth) {
641
627
  entity.setAttribute('depth', figure.depth);
642
628
  }
643
- entity.setAttribute('position', {
644
- x: figure.posX - translate.x,
645
- y: (parseFloat(figure.height) + translate.y) / 2,
646
- z: - figure.posY + translate.z
647
- });
648
-
649
- if (figure.children){
629
+
630
+ //TODO: Full opacity because it was in 0.5 if new building/quarter
631
+ if(entity.components.material.data.opacity < 1){
632
+ setOpacity(entity, 1)
633
+ }
634
+
635
+ entity.object3D.position.set(
636
+ figure.posX - translate.x,
637
+ ((parseFloat(figure.height) + translate.y) / 2),
638
+ (- figure.posY + translate.z),
639
+ )
640
+ if (figure.children) {
650
641
  this.setFigures(figure.children, figure.translate_matrix);
651
642
  }
652
643
  }
@@ -697,6 +688,7 @@ AFRAME.registerComponent('babia-boats', {
697
688
  entity.setAttribute('width', new_width);
698
689
  entity.setAttribute('height', new_height);
699
690
  entity.setAttribute('depth', new_depth);
691
+ entity.babiaRawData = figure.rawData
700
692
 
701
693
  } else if (((new_time - this.start_time) > this.duration) &&
702
694
  ((figure.width != figure_old.width) ||
@@ -706,7 +698,7 @@ AFRAME.registerComponent('babia-boats', {
706
698
  entity.setAttribute('width', figure.width);
707
699
  entity.setAttribute('height', figure.height);
708
700
  entity.setAttribute('depth', figure.depth);
709
- entity.setAttribute('babiaRawData', JSON.stringify(figure.rawData))
701
+ entity.babiaRawData = figure.rawData
710
702
  }
711
703
  },
712
704
 
@@ -722,9 +714,9 @@ AFRAME.registerComponent('babia-boats', {
722
714
  let inc_y = (delta * dist_y) / (2 * this.duration);
723
715
  let inc_z = (delta * dist_z) / this.duration;
724
716
 
725
- let last_x = parseFloat(entity.getAttribute('position').x);
726
- let last_y = parseFloat(entity.getAttribute('position').y);
727
- let last_z = parseFloat(entity.getAttribute('position').z);
717
+ let last_x = parseFloat(entity.object3D.position.x);
718
+ let last_y = parseFloat(entity.object3D.position.y);
719
+ let last_z = parseFloat(entity.object3D.position.z);
728
720
 
729
721
  let new_x = last_x - inc_x;
730
722
  let new_y = last_y + inc_y;
@@ -732,18 +724,18 @@ AFRAME.registerComponent('babia-boats', {
732
724
 
733
725
 
734
726
  // Update entity
735
- entity.setAttribute('position', {
736
- x: new_x,
737
- y: new_y,
738
- z: new_z
739
- });
727
+ entity.object3D.position.set(
728
+ new_x,
729
+ new_y,
730
+ new_z
731
+ )
740
732
 
741
733
  } else if ((new_time - this.start_time) > this.duration) {
742
- entity.setAttribute('position', {
743
- x: figure.posX - translate.x,
744
- y: (parseFloat(figure.height) + translate.y) / 2,
745
- z: - figure.posY + translate.z
746
- });
734
+ entity.object3D.position.set(
735
+ (figure.posX - translate.x),
736
+ ((parseFloat(figure.height) + translate.y) / 2),
737
+ (- figure.posY + translate.z),
738
+ )
747
739
  }
748
740
  }
749
741
  },
@@ -779,7 +771,7 @@ AFRAME.registerComponent('babia-boats', {
779
771
  entity.setAttribute('depth', depth);
780
772
  // rawData building
781
773
  if (figure.rawData) {
782
- entity.setAttribute('babiaRawData', JSON.stringify(figure.rawData))
774
+ entity.babiaRawData = figure.rawData
783
775
  }
784
776
 
785
777
  // add into scene
@@ -800,7 +792,7 @@ AFRAME.registerComponent('babia-boats', {
800
792
  let data = this.data;
801
793
  this.newData = _data;
802
794
  this.babiaMetadata = { id: this.babiaMetadata.id++ };
803
-
795
+
804
796
  // If color metric activated, save in the metadata the max and min value for mapping
805
797
  if (data.color) {
806
798
  let [color_max, color_min] = getMaxMinColorValues(this.newData, data.color)
@@ -809,7 +801,7 @@ AFRAME.registerComponent('babia-boats', {
809
801
  }
810
802
  this.notiBuffer.set(this.newData)
811
803
  // Create city
812
- this.updateChart(this.newData)
804
+ this.updateChart(this.newData)
813
805
  },
814
806
 
815
807
  addEvents: function (entity, figure) {
@@ -854,7 +846,7 @@ AFRAME.registerComponent('babia-boats', {
854
846
  });
855
847
  entity.appendChild(transparentBox)
856
848
 
857
- legend = generateLegend(figure.name, self.data.legend_scale, 'black', 'white');
849
+ legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'black', 'white');
858
850
  let worldPos = new THREE.Vector3();
859
851
  let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
860
852
  let coordinatesFinal = {
@@ -919,7 +911,7 @@ AFRAME.registerComponent('babia-boats', {
919
911
  depth: entityGeometry.depth + 0.1,
920
912
  width: entityGeometry.width + 0.1
921
913
  });
922
- legend = generateLegend(figure.name, self.data.legend_scale, 'white', 'black', JSON.parse(entity.getAttribute('babiaRawData')), self.data.height, self.data.area, self.data.depth, self.data.width, self.data.color);
914
+ legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'white', 'black', entity.babiaRawData, self.data.height, self.data.area, self.data.depth, self.data.width, self.data.color);
923
915
  let worldPos = new THREE.Vector3();
924
916
  let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
925
917
  let height_real = new THREE.Box3().setFromObject(entity.object3D)
@@ -953,7 +945,7 @@ AFRAME.registerComponent('babia-boats', {
953
945
  depth: entityGeometry.depth + 0.1,
954
946
  width: entityGeometry.width + 0.1
955
947
  });
956
- legend = generateLegend(figure.name, self.data.legend_scale, 'white', 'black', JSON.parse(entity.getAttribute('babiaRawData')), self.data.height, self.data.area, self.data.depth, self.data.width, self.data.color);
948
+ legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'white', 'black', entity.babiaRawData, self.data.height, self.data.area, self.data.depth, self.data.width, self.data.color);
957
949
  let worldPos = new THREE.Vector3();
958
950
  let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
959
951
  let height_real = new THREE.Box3().setFromObject(entity.object3D)
@@ -990,7 +982,7 @@ AFRAME.registerComponent('babia-boats', {
990
982
  /**
991
983
  * This function generate a plane at the top of the building with the desired text
992
984
  */
993
- let generateLegend = (name, legend_scale, colorPlane, colorText, data, fheight, farea, fdepth, fwidth, fcolor) => {
985
+ let generateLegend = (name, legend_scale, lookat, colorPlane, colorText, data, fheight, farea, fdepth, fwidth, fcolor) => {
994
986
  let width = 2;
995
987
  let height = 1;
996
988
  if (name.length > 16)
@@ -1031,7 +1023,7 @@ let generateLegend = (name, legend_scale, colorPlane, colorText, data, fheight,
1031
1023
  }
1032
1024
 
1033
1025
  let entity = document.createElement('a-plane');
1034
- entity.setAttribute('babia-lookat', "[camera]");
1026
+ entity.setAttribute('babia-lookat', lookat);
1035
1027
 
1036
1028
  entity.setAttribute('rotation', { x: 0, y: 0, z: 0 });
1037
1029
  entity.setAttribute('height', height);
@@ -1117,8 +1109,8 @@ function heatMapColorforValue(val, max, min) {
1117
1109
  let findIndex = (list, condicion) => {
1118
1110
  condicion = condicion.split('=')
1119
1111
  //console.log(condicion)
1120
- for (i = 0; i < list.length; i++){
1121
- if (list[i][condicion[0]] === condicion[1]){
1112
+ for (i = 0; i < list.length; i++) {
1113
+ if (list[i][condicion[0]] === condicion[1]) {
1122
1114
  return i
1123
1115
  }
1124
1116
  }
@@ -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
 
@@ -46,36 +45,20 @@ AFRAME.registerComponent('babia-bubbles', {
46
45
  */
47
46
  multiple: false,
48
47
 
48
+ /**
49
+ * Called once when component is attached. Generally for initial setup.
50
+ */
51
+ init: function () {
52
+ this.notiBuffer = new NotiBuffer();
53
+ },
54
+
49
55
  /**
50
56
  * Called when component is attached and when component data changes.
51
57
  * Generally modifies the entity based on the data.
52
58
  */
53
59
 
54
60
  update: function (oldData) {
55
- let data = this.data;
56
- let el = this.el;
57
-
58
- /**
59
- * Update or create chart component
60
- */
61
- if (data.data && oldData.data !== data.data) {
62
- let _data = parseJson(data.data);
63
- this.processData(_data);
64
- } else if (data.from !== oldData.from) {
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.processData(this.newData)
78
- }
61
+ updateFunction(this, oldData)
79
62
  },
80
63
 
81
64
  /**