Skip to content

Commit 295a683

Browse files
author
Léna Voinchet
committed
Fix sensor ID bug
1 parent a464b35 commit 295a683

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

js/UI/NodeUI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class NodeUI{
2626
<div id="node-` + (node.id) + `-UI-header" class="row center-x-spaced center-y">
2727
<div class="row center-y">
2828
<div class="sensor-color" style="background-color: #`+ node.color.getHexString() + `;"></div>
29-
<p class="main-text">Sensor ` + (node.id + 1) + `</p>
29+
<p class="main-text">Camera ` + (node.id + 1) + `</p>
3030
</div>
3131
<div class="row center-y">
3232
<!-- <div id="node-` + (node.id) + `-solo-button"><span class="iconify" data-icon="bx:search-alt-2"></span></div> -->

js/scene/SceneManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class SceneManager{
285285

286286
/* USER'S ACTIONS */
287287

288-
/* TODO: Maybe move it to UIManager /!\ Is used by builder which does'nt have access to uiManager */
288+
/* TODO: Maybe move it to UIManager /!\ Is used by builder which doesn't have access to uiManager */
289289
this.toggleUnit = function(unit = this.currentUnit.value === units.meters.value ? units.feets : units.meters)
290290
{
291291
if(this.augmentaSceneLoaded)

js/scene/objects/SceneObjects.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class SceneObjects{
2929
this.nodeMeshes = [];
3030
this.lidarsMeshes = [];
3131
this.dummiesMeshes = [];
32+
this.numberOfNodesCreated = 0;
33+
this.numberOfLidarsCreated = 0;
3234

3335
const givenAreaPolygonRegions = [[]];
3436

@@ -152,7 +154,8 @@ class SceneObjects{
152154
console.log("Add Node button will work in an instant");
153155
return;
154156
}
155-
const newCamera = new Node(nodes.length, mode, typeID, x, y, z, p, a, r)
157+
const newCamera = new Node(this.numberOfNodesCreated, mode, typeID, x, y, z, p, a, r);
158+
this.numberOfNodesCreated++;
156159
if(!isBuilder) newCamera.uiElement = new NodeUI(newCamera, sceneManager);
157160

158161
//Offset
@@ -176,6 +179,9 @@ class SceneObjects{
176179

177180
sceneManager.sceneSensorHeight = z;
178181

182+
document.getElementById("display-lidars-rays-button").classList.add("hidden");
183+
document.getElementById("display-frustums-button").classList.remove("hidden");
184+
179185
this.populateStorage();
180186
}
181187

@@ -220,7 +226,8 @@ class SceneObjects{
220226
console.log("Add Lidar button will work in an instant");
221227
return;
222228
}
223-
const newLidar = new Lidar(lidars.length, typeID, x, z, r);
229+
const newLidar = new Lidar(this.numberOfLidarsCreated, typeID, x, z, r);
230+
this.numberOfLidarsCreated++;
224231
if(!isBuilder) newLidar.uiElement = new LidarUI(newLidar, sceneManager);
225232

226233
//Offset
@@ -242,6 +249,9 @@ class SceneObjects{
242249
lidars.push(newLidar);
243250
this.lidarsMeshes.push(newLidar.mesh);
244251

252+
document.getElementById("display-lidars-rays-button").classList.remove("hidden");
253+
document.getElementById("display-frustums-button").classList.add("hidden");
254+
245255
this.populateStorage();
246256
}
247257

@@ -250,14 +260,14 @@ class SceneObjects{
250260
const visibles = lidars.filter(l => l.raysAppear);
251261
lidars.forEach(l => l.changeVisibility(visibles.length != lidars.length));
252262
const iconElem = document.getElementById('display-lidars-rays-button-icon');
253-
if(iconElem) iconElem.dataset.icon = visibles.length != nodes.length ? "akar-icons:eye-open" : "akar-icons:eye-slashed";
263+
if(iconElem) iconElem.dataset.icon = visibles.length != nodes.length ? "akar-icons:eye-slashed" : "akar-icons:eye-open";
254264
}
255265

256266
this.updateRaysIcon = function()
257267
{
258268
const visibles = lidars.filter(l => l.raysAppear);
259269
const iconElem = document.getElementById('display-lidars-rays-button-icon');
260-
if(iconElem) iconElem.dataset.icon = visibles.length != 0 ? "akar-icons:eye-open" : "akar-icons:eye-slashed";
270+
if(iconElem) iconElem.dataset.icon = visibles.length != 0 ? "akar-icons:eye-slashed" : "akar-icons:eye-open";
261271
}
262272

263273
this.removeLidars = function()

0 commit comments

Comments
 (0)