aframe-babia-components 1.2.7 → 1.2.9
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-treebuilder.js +1 -1
- package/components/visualizers/babia-boats.js +153 -67
- package/components/visualizers/babia-doughnut.js +2 -1
- package/components/visualizers/babia-html.js +255 -0
- package/components/visualizers/babia-pie.js +2 -1
- package/dist/aframe-babia-components.js +391 -49
- package/dist/aframe-babia-components.min.js +1 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +5 -1
- package/docs/APIs/OTHERS.md +18 -8
- package/docs/RELEASE_NOTES.md +8 -0
- package/examples/boats/boats2/data.json +13 -206
- package/examples/charts/pie/index.html +5 -0
- package/examples/demos/citations/babiaxr.json +1 -0
- package/examples/demos/citations/citations.html +72 -0
- package/examples/demos/citations/music.mp3 +0 -0
- package/examples/demos/citations/stl.js +28 -0
- package/examples/example-template.html +7 -6
- package/examples/experiment/city.html +13 -9
- package/examples/htmlinxr/complex.html +219 -0
- package/examples/htmlinxr/simple.html +163 -0
- package/examples/publications/codecityvs/index.html +12 -10
- package/examples/publications/dashboard/index.html +3 -2
- package/examples/publications/elevated/index.html +2 -1
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -90,7 +90,7 @@ AFRAME.registerComponent('babia-treebuilder', {
|
|
|
90
90
|
if (!path[j]) { continue }
|
|
91
91
|
|
|
92
92
|
let part = path[j];
|
|
93
|
-
console.log("currentLevel", currentLevel)
|
|
93
|
+
//console.log("currentLevel", currentLevel)
|
|
94
94
|
let existingPath = findWhere(currentLevel, 'name', part);
|
|
95
95
|
|
|
96
96
|
if (existingPath) {
|
|
@@ -29,7 +29,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
29
29
|
// Differential heights for buildings (the height of
|
|
30
30
|
// buildings is calculated relative to the difference between
|
|
31
31
|
// highest and lowest value)
|
|
32
|
-
diffBuildingHeight: {type: 'boolean', default: false},
|
|
32
|
+
diffBuildingHeight: { type: 'boolean', default: false },
|
|
33
33
|
zone_elevation: { type: 'number', default: 0.01 },
|
|
34
34
|
building_separation: { type: 'number', default: 0.25 },
|
|
35
35
|
extra: { type: 'number', default: 1.0 },
|
|
@@ -45,8 +45,12 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
45
45
|
height_building_legend: { type: 'number', default: 0 },
|
|
46
46
|
legend_scale: { type: 'number', default: 1 },
|
|
47
47
|
legend_lookat: { type: 'string', default: "[camera]" },
|
|
48
|
+
legendsAsChildren: { type: 'boolean', default: false },
|
|
49
|
+
legendsAsChildrenHeight: { type: 'number', default: 3 },
|
|
48
50
|
metricsInfoId: { type: 'string', default: "" },
|
|
49
51
|
highlightQuarter: { type: 'boolean', default: false },
|
|
52
|
+
hideQuarterBoxLegend: { type: 'boolean', default: false },
|
|
53
|
+
highlightQuarterByClick: { type: 'boolean', default: false },
|
|
50
54
|
field: { type: 'string', default: 'uid' },
|
|
51
55
|
|
|
52
56
|
// Numeric color legend entity to hide/show
|
|
@@ -191,9 +195,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
191
195
|
y: self.data.height_quarter_legend_title,
|
|
192
196
|
z: coordinates.z
|
|
193
197
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
self.
|
|
198
|
+
|
|
199
|
+
// If legend is a child of the building/quarter
|
|
200
|
+
if (self.data.legendsAsChildren) {
|
|
201
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
202
|
+
entity.legend.setAttribute('visible', true);
|
|
203
|
+
entity.appendChild(entity.legend)
|
|
204
|
+
} else {
|
|
205
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
206
|
+
entity.legend.setAttribute('visible', true);
|
|
207
|
+
self.el.parentElement.appendChild(entity.legend)
|
|
208
|
+
}
|
|
209
|
+
|
|
197
210
|
|
|
198
211
|
self.legendsActive.push(entity.legend)
|
|
199
212
|
entity.alreadyActive = true
|
|
@@ -223,7 +236,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
223
236
|
},
|
|
224
237
|
|
|
225
238
|
updateChart: function (items) {
|
|
226
|
-
console.log('Data Loaded.');
|
|
239
|
+
//console.log('Data Loaded.');
|
|
227
240
|
let t = { x: 0, y: 0, z: 0 };
|
|
228
241
|
this.idsToNotRepeatWireframe = []
|
|
229
242
|
this.idsToNotRepeat20Transparent = []
|
|
@@ -359,11 +372,11 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
359
372
|
height_min = self.babiaMetadata['heightMin'];
|
|
360
373
|
};
|
|
361
374
|
element.height = self.normalizeValues(height_min,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
375
|
+
self.babiaMetadata['heightMax'],
|
|
376
|
+
self.data.minBuildingHeight,
|
|
377
|
+
self.data.maxBuildingHeight,
|
|
378
|
+
elements[i][this.data.height])
|
|
379
|
+
|| this.data.minBuildingHeight
|
|
367
380
|
}
|
|
368
381
|
if (this.data.depth) {
|
|
369
382
|
element.depth = elements[i][this.data.depth] || 0.5
|
|
@@ -482,11 +495,11 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
482
495
|
if (elements[i].children) {
|
|
483
496
|
// This is the base for a quarter
|
|
484
497
|
figure.name = elements[i][this.data.field] || '',
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
498
|
+
figure.width = element.width,
|
|
499
|
+
figure.depth = element.depth,
|
|
500
|
+
figure.children = children,
|
|
501
|
+
figure.alpha = self.data.baseAlpha,
|
|
502
|
+
figure.translate_matrix = translate_matrix
|
|
490
503
|
// TEST TREE
|
|
491
504
|
if (self.data.treeLayout) {
|
|
492
505
|
figure.treeMetaphorHeight = element.treeMetaphorHeight
|
|
@@ -498,10 +511,10 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
498
511
|
if (self.data.gradientBaseColor) {
|
|
499
512
|
figure.color = greenColorsurface(Math.round(
|
|
500
513
|
self.normalizeValues(1,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
514
|
+
self.babiaMetadata['maxLevels'],
|
|
515
|
+
15,
|
|
516
|
+
100,
|
|
517
|
+
hierarchyLevel)
|
|
505
518
|
));
|
|
506
519
|
} else {
|
|
507
520
|
figure.color = self.data.base_color;
|
|
@@ -509,7 +522,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
509
522
|
} else {
|
|
510
523
|
// This is a building
|
|
511
524
|
figure.name = (elements[i].name) ? elements[i].name : elements[i][this.data.field],
|
|
512
|
-
|
|
525
|
+
figure.alpha = self.data.buildingAlpha
|
|
513
526
|
if (this.data.area) {
|
|
514
527
|
figure.width = Math.sqrt(element.area);
|
|
515
528
|
figure.depth = Math.sqrt(element.area);
|
|
@@ -676,12 +689,12 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
676
689
|
let height_min = 0;
|
|
677
690
|
if (self.data.diffBuildingHeight) {
|
|
678
691
|
height_min = self.babiaMetadata['heightMin'];
|
|
679
|
-
};
|
|
692
|
+
};
|
|
680
693
|
position.y = (self.normalizeValues(height_min,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
694
|
+
self.babiaMetadata['heightMax'],
|
|
695
|
+
self.data.minBuildingHeight,
|
|
696
|
+
self.data.maxBuildingHeight,
|
|
697
|
+
figures[i].treeMetaphorHeight))
|
|
685
698
|
} else {
|
|
686
699
|
position.y = ((height / 2 + translate.y / 2)) - height - 0.001
|
|
687
700
|
}
|
|
@@ -836,6 +849,9 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
836
849
|
// find index in old_figures
|
|
837
850
|
let cond = 'id=' + figures[i].id
|
|
838
851
|
let index = findIndex(figures_old, cond)
|
|
852
|
+
|
|
853
|
+
// Update rawData
|
|
854
|
+
entity.babiaRawData = figures[i].rawData
|
|
839
855
|
if (index < 0) {
|
|
840
856
|
// encontrar el elemento que no esta en la escena con id y darle opacidad
|
|
841
857
|
// y cambiar sus propiedades a la nueva si es necesario
|
|
@@ -1060,14 +1076,14 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1060
1076
|
let height_min = 0;
|
|
1061
1077
|
if (self.data.diffBuildingHeight) {
|
|
1062
1078
|
height_min = self.babiaMetadata['heightMin'];
|
|
1063
|
-
};
|
|
1079
|
+
};
|
|
1064
1080
|
entity.object3D.position.set(
|
|
1065
1081
|
figure.posX - translate.x,
|
|
1066
1082
|
self.normalizeValues(height_min,
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1083
|
+
self.babiaMetadata['heightMax'],
|
|
1084
|
+
self.data.minBuildingHeight,
|
|
1085
|
+
self.data.maxBuildingHeight,
|
|
1086
|
+
figure.treeMetaphorHeight),
|
|
1071
1087
|
- figure.posY + translate.z,
|
|
1072
1088
|
)
|
|
1073
1089
|
} else {
|
|
@@ -1139,7 +1155,6 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1139
1155
|
entity.setAttribute('width', new_width);
|
|
1140
1156
|
entity.setAttribute('height', new_height);
|
|
1141
1157
|
entity.setAttribute('depth', new_depth);
|
|
1142
|
-
entity.babiaRawData = figure.rawData
|
|
1143
1158
|
|
|
1144
1159
|
//Check if has transparent box as a quarter
|
|
1145
1160
|
if (entity.classList.contains('babiaquarterboxactivated')) {
|
|
@@ -1161,7 +1176,6 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1161
1176
|
entity.setAttribute('width', figure.width);
|
|
1162
1177
|
entity.setAttribute('height', figure.height);
|
|
1163
1178
|
entity.setAttribute('depth', figure.depth);
|
|
1164
|
-
entity.babiaRawData = figure.rawData
|
|
1165
1179
|
|
|
1166
1180
|
//Check if has transparent box as a quarter
|
|
1167
1181
|
if (entity.classList.contains('babiaquarterboxactivated')) {
|
|
@@ -1265,6 +1279,8 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1265
1279
|
|
|
1266
1280
|
// create box
|
|
1267
1281
|
entity.setAttribute('color', color);
|
|
1282
|
+
// Store init color
|
|
1283
|
+
entity.setAttribute('babiaxrFirstColor', color)
|
|
1268
1284
|
entity.setAttribute('width', width);
|
|
1269
1285
|
entity.setAttribute('height', height);
|
|
1270
1286
|
entity.setAttribute('depth', depth);
|
|
@@ -1307,7 +1323,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1307
1323
|
*/
|
|
1308
1324
|
processData: function (_data) {
|
|
1309
1325
|
const self = this
|
|
1310
|
-
console.log("processData", _data);
|
|
1326
|
+
//console.log("processData", _data);
|
|
1311
1327
|
let data = this.data;
|
|
1312
1328
|
this.newData = _data;
|
|
1313
1329
|
this.babiaMetadata = { id: this.babiaMetadata.id++ };
|
|
@@ -1455,15 +1471,33 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1455
1471
|
// dont add events flag (if transparent)
|
|
1456
1472
|
if (!figure.dontAddEvents) {
|
|
1457
1473
|
let transparentBox;
|
|
1474
|
+
|
|
1458
1475
|
entity.addEventListener('click', function (e) {
|
|
1459
1476
|
// Just launch the event on the child
|
|
1460
1477
|
if (e.target !== this)
|
|
1461
1478
|
return;
|
|
1462
1479
|
|
|
1463
1480
|
if (entity.legend) {
|
|
1464
|
-
|
|
1481
|
+
// Only if it not activated
|
|
1482
|
+
if (!self.data.hideQuarterBoxLegend) {
|
|
1483
|
+
self.el.parentElement.removeChild(transparentBox)
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// Only if highlighted activated
|
|
1487
|
+
if (self.data.highlightQuarterByClick) {
|
|
1488
|
+
entity.setAttribute('material', 'color', entity.getAttribute('babiaxrFirstColor'))
|
|
1489
|
+
entity.setAttribute('babiaxrHightlightedByClick', false)
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1465
1492
|
entity.classList.remove("babiaquarterboxactivated");
|
|
1466
|
-
|
|
1493
|
+
|
|
1494
|
+
// If legend is a child of the building/quarter
|
|
1495
|
+
if (self.data.legendsAsChildren) {
|
|
1496
|
+
entity.removeChild(entity.legend)
|
|
1497
|
+
} else {
|
|
1498
|
+
self.el.parentElement.removeChild(entity.legend)
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1467
1501
|
|
|
1468
1502
|
// Remove from the array that has the entity activated and the legend
|
|
1469
1503
|
const index = self.entitiesWithLegend.findIndex(item => item.entity === entity);
|
|
@@ -1479,27 +1513,39 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1479
1513
|
transparentBox = undefined
|
|
1480
1514
|
|
|
1481
1515
|
} else {
|
|
1482
|
-
|
|
1483
|
-
transparentBox.setAttribute('class', 'babiaquarterlegendbox')
|
|
1484
|
-
entity.classList.add("babiaquarterboxactivated");
|
|
1485
|
-
let oldGeometry = entity.getAttribute('geometry')
|
|
1486
|
-
let scale = self.el.getAttribute("scale") || { x: 1, y: 1, z: 1 }
|
|
1487
|
-
let tsBoxHeight = (oldGeometry.height * scale.y) + self.data.height_quarter_legend_box
|
|
1488
|
-
transparentBox.setAttribute('geometry', {
|
|
1489
|
-
height: tsBoxHeight,
|
|
1490
|
-
depth: oldGeometry.depth * scale.z,
|
|
1491
|
-
width: oldGeometry.width * scale.x
|
|
1492
|
-
});
|
|
1493
|
-
transparentBox.setAttribute('material', {
|
|
1494
|
-
'visible': true,
|
|
1495
|
-
'opacity': 0.4
|
|
1496
|
-
});
|
|
1497
|
-
// This is because the webGL render order does not work well with the transparencies
|
|
1498
|
-
transparentBox.object3D.renderOrder = 1000000000
|
|
1516
|
+
// Global coordinates
|
|
1499
1517
|
let worldPos = new THREE.Vector3();
|
|
1500
1518
|
let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
|
|
1501
|
-
|
|
1502
|
-
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
if (!self.data.hideQuarterBoxLegend) {
|
|
1522
|
+
transparentBox = document.createElement('a-entity');
|
|
1523
|
+
transparentBox.setAttribute('class', 'babiaquarterlegendbox')
|
|
1524
|
+
entity.classList.add("babiaquarterboxactivated");
|
|
1525
|
+
let oldGeometry = entity.getAttribute('geometry')
|
|
1526
|
+
let scale = self.el.getAttribute("scale") || { x: 1, y: 1, z: 1 }
|
|
1527
|
+
let tsBoxHeight = (oldGeometry.height * scale.y) + self.data.height_quarter_legend_box
|
|
1528
|
+
transparentBox.setAttribute('geometry', {
|
|
1529
|
+
height: tsBoxHeight,
|
|
1530
|
+
depth: oldGeometry.depth * scale.z,
|
|
1531
|
+
width: oldGeometry.width * scale.x
|
|
1532
|
+
});
|
|
1533
|
+
transparentBox.setAttribute('material', {
|
|
1534
|
+
'visible': true,
|
|
1535
|
+
'opacity': 0.4
|
|
1536
|
+
});
|
|
1537
|
+
// This is because the webGL render order does not work well with the transparencies
|
|
1538
|
+
transparentBox.object3D.renderOrder = 1000000000
|
|
1539
|
+
|
|
1540
|
+
transparentBox.setAttribute('position', coordinates)
|
|
1541
|
+
self.el.parentElement.appendChild(transparentBox)
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
// If quarter is highlighted using the click
|
|
1545
|
+
if (self.data.highlightQuarterByClick) {
|
|
1546
|
+
//entity.setAttribute('babiaxrFirstColor', entity.getAttribute("material")["color"])
|
|
1547
|
+
entity.setAttribute('material', 'color', '#bfbfbf')
|
|
1548
|
+
}
|
|
1503
1549
|
|
|
1504
1550
|
let coordinatesFinal = {
|
|
1505
1551
|
x: coordinates.x,
|
|
@@ -1507,9 +1553,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1507
1553
|
z: coordinates.z
|
|
1508
1554
|
}
|
|
1509
1555
|
entity.legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'black', 'white');
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
self.
|
|
1556
|
+
|
|
1557
|
+
// If legend is a child of the building/quarter
|
|
1558
|
+
if (self.data.legendsAsChildren) {
|
|
1559
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
1560
|
+
entity.legend.setAttribute('visible', true);
|
|
1561
|
+
entity.appendChild(entity.legend)
|
|
1562
|
+
} else {
|
|
1563
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
1564
|
+
entity.legend.setAttribute('visible', true);
|
|
1565
|
+
self.el.parentElement.appendChild(entity.legend)
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1513
1568
|
|
|
1514
1569
|
// Add to the elements that has the legend activated
|
|
1515
1570
|
self.entitiesWithLegend.push({ 'figure': figure, 'entity': entity })
|
|
@@ -1554,7 +1609,13 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1554
1609
|
entity.setAttribute('material', {
|
|
1555
1610
|
'color': entity.getAttribute('babiaxrFirstColor')
|
|
1556
1611
|
});
|
|
1557
|
-
|
|
1612
|
+
|
|
1613
|
+
// If legend is a child of the building/quarter
|
|
1614
|
+
if (self.data.legendsAsChildren) {
|
|
1615
|
+
entity.removeChild(entity.legend)
|
|
1616
|
+
} else {
|
|
1617
|
+
self.el.parentElement.removeChild(entity.legend)
|
|
1618
|
+
}
|
|
1558
1619
|
|
|
1559
1620
|
// Remove from the array that has the entity activated
|
|
1560
1621
|
const index = self.entitiesWithLegend.findIndex(item => item.entity === entity);
|
|
@@ -1615,9 +1676,19 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1615
1676
|
y: height_real.max.y + 1 + self.data.height_building_legend,
|
|
1616
1677
|
z: coordinates.z
|
|
1617
1678
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
self.
|
|
1679
|
+
|
|
1680
|
+
// If legend is a child of the building/quarter
|
|
1681
|
+
if (self.data.legendsAsChildren) {
|
|
1682
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
1683
|
+
entity.legend.setAttribute('visible', true);
|
|
1684
|
+
entity.appendChild(entity.legend)
|
|
1685
|
+
} else {
|
|
1686
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
1687
|
+
entity.legend.setAttribute('visible', true);
|
|
1688
|
+
self.el.parentElement.appendChild(entity.legend);
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
|
|
1621
1692
|
}
|
|
1622
1693
|
|
|
1623
1694
|
// Higlight quarter
|
|
@@ -1626,7 +1697,6 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1626
1697
|
let oldPosition = entity.parentElement.getAttribute("position")
|
|
1627
1698
|
entity.parentElement.setAttribute('babiaxrFirstYPosition', oldPosition.y)
|
|
1628
1699
|
entity.parentElement.setAttribute("position", { x: oldPosition.x, y: oldPosition.y + 0.2, z: oldPosition.z })
|
|
1629
|
-
entity.parentElement.setAttribute('babiaxrFirstColor', entity.parentElement.getAttribute("material")["color"])
|
|
1630
1700
|
entity.parentElement.setAttribute('material', 'color', '#bfbfbf')
|
|
1631
1701
|
entity.parentElement.setAttribute('babiaxrHightlighted', 1)
|
|
1632
1702
|
} else {
|
|
@@ -1660,7 +1730,9 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1660
1730
|
entityGeometry = entity.getAttribute('geometry')
|
|
1661
1731
|
let boxPosition = entity.getAttribute('position')
|
|
1662
1732
|
entity.setAttribute('position', boxPosition)
|
|
1663
|
-
|
|
1733
|
+
// If the color is not a field, it is stored at "color"
|
|
1734
|
+
let firstColor = entity.getAttribute("material")["color"] !== "undefined" ? entity.getAttribute("material")["color"] : self.data.building_color;
|
|
1735
|
+
entity.setAttribute('babiaxrFirstColor', firstColor)
|
|
1664
1736
|
entity.setAttribute('material', {
|
|
1665
1737
|
'color': 'white'
|
|
1666
1738
|
});
|
|
@@ -1678,9 +1750,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1678
1750
|
y: height_real.max.y + 1 + self.data.height_building_legend,
|
|
1679
1751
|
z: coordinates.z
|
|
1680
1752
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
self.
|
|
1753
|
+
|
|
1754
|
+
// If legend is a child of the building/quarter
|
|
1755
|
+
if (self.data.legendsAsChildren) {
|
|
1756
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
1757
|
+
entity.legend.setAttribute('visible', true);
|
|
1758
|
+
entity.appendChild(entity.legend)
|
|
1759
|
+
} else {
|
|
1760
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
1761
|
+
entity.legend.setAttribute('visible', true);
|
|
1762
|
+
self.el.parentElement.appendChild(entity.legend);
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1684
1765
|
|
|
1685
1766
|
// Hihglight by field
|
|
1686
1767
|
if (self.data.highlightBuildingByField) {
|
|
@@ -1708,7 +1789,12 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1708
1789
|
entity.setAttribute('material', {
|
|
1709
1790
|
'color': entity.getAttribute('babiaxrFirstColor')
|
|
1710
1791
|
});
|
|
1711
|
-
|
|
1792
|
+
// If legend is a child of the building/quarter
|
|
1793
|
+
if (self.data.legendsAsChildren) {
|
|
1794
|
+
entity.removeChild(entity.legend)
|
|
1795
|
+
} else {
|
|
1796
|
+
self.el.parentElement.removeChild(entity.legend)
|
|
1797
|
+
}
|
|
1712
1798
|
entity.legend = undefined
|
|
1713
1799
|
}
|
|
1714
1800
|
|
|
@@ -57,8 +57,9 @@ AFRAME.registerComponent('babia-doughnut', {
|
|
|
57
57
|
* Called on each scene tick.
|
|
58
58
|
*/
|
|
59
59
|
tick: function (t, delta) {
|
|
60
|
+
let self = this
|
|
60
61
|
if (this.data.animation && this.loaded) {
|
|
61
|
-
let elements =
|
|
62
|
+
let elements = self.el.children[0].children
|
|
62
63
|
for (let slice in this.slice_array) {
|
|
63
64
|
let delay = this.slice_array[slice].delay
|
|
64
65
|
let max_arc = this.slice_array[slice].arc
|