@@ -18,48 +18,48 @@ class LidarUI{
18
18
const lidarUIdiv = document . createElement ( 'div' ) ;
19
19
lidarUIdiv . classList . add ( "sensorUI" ) ;
20
20
21
- lidarUIdiv . id = ' lidar-' + ( lidar . id ) + ' -UI' ;
21
+ lidarUIdiv . id = ` lidar-${ lidar . id } -UI` ;
22
22
lidarUIdiv . innerHTML = `
23
- <div id="lidar-` + ( lidar . id ) + ` -UI-header" class="row center-x-spaced center-y">
23
+ <div id="lidar-${ lidar . id } -UI-header" class="row center-x-spaced center-y">
24
24
<div class="row center-y">
25
- <div class="sensor-color" style="background-color: #` + lidar . color . getHexString ( ) + ` ;"></div>
26
- <p class="main-text">LiDAR ` + ( lidar . id + 1 ) + ` </p>
25
+ <div class="sensor-color" style="background-color: #${ lidar . color . getHexString ( ) } ;"></div>
26
+ <p class="main-text">LiDAR ${ lidar . id + 1 } </p>
27
27
</div>
28
28
<div class="row center-y">
29
- <!-- <div id="lidar-` + ( lidar . id ) + ` -solo-button"><span class="iconify" data-icon="bx:search-alt-2"></span></div> -->
30
- <div id="lidar-` + ( lidar . id ) + ` -hide-UI"><span class="iconify" data-icon="bx:minus"></span></div>
31
- <div id="lidar-` + ( lidar . id ) + ` -visible"><span class="iconify" data-icon="akar-icons:eye-open"></span></div>
29
+ <!-- <div id="lidar-${ lidar . id } -solo-button"><span class="iconify" data-icon="bx:search-alt-2"></span></div> -->
30
+ <div id="lidar-${ lidar . id } -hide-UI"><span class="iconify" data-icon="bx:minus"></span></div>
31
+ <div id="lidar-${ lidar . id } -visible"><span class="iconify" data-icon="akar-icons:eye-open"></span></div>
32
32
<!-- <div><span class="iconify" data-icon="fluent:lock-open-16-regular"></span></div> -->
33
- <div id="lidar-` + ( lidar . id ) + ` -delete"><span class="iconify" data-icon="fluent:delete-16-filled"></span></div>
33
+ <div id="lidar-${ lidar . id } -delete"><span class="iconify" data-icon="fluent:delete-16-filled"></span></div>
34
34
</div>
35
35
</div>
36
- <div id="lidar-infos-` + ( lidar . id ) + ` -UI" class="column sections-container space-y">
36
+ <div id="lidar-infos-${ lidar . id } -UI" class="column sections-container space-y">
37
37
<div id="select-lidar-type" class="row center-y">
38
- <select title="lidarType-` + ( lidar . id ) + ` " name="lidarType-` + ( lidar . id ) + ` " id="lidar-type-` + ( lidar . id ) + ` ">
39
- ` + lidarTypesOptions + `
38
+ <select title="lidarType-${ lidar . id } " name="lidarType-${ lidar . id } " id="lidar-type-${ lidar . id } ">
39
+ ${ lidarTypesOptions }
40
40
</select>
41
41
</div>
42
42
<div class="row sensor-transformations">
43
43
<p class="main-text">Transf.</p>
44
44
<div>
45
- <p id="lidar-x-pos-` + lidar . id + ` " class="draggable">Pos. X <strong data-unit=` + sceneManager . currentUnit . value + `>` + Math . round ( lidar . xPos * sceneManager . currentUnit . value * 100 ) / 100.0 + ` </strong><span data-unittext=` + sceneManager . currentUnit . value + `>` + sceneManager . currentUnit . label + ` </span></p>
45
+ <p id="lidar-x-pos-${ lidar . id } " class="draggable">Pos. X <strong data-unit=${ sceneManager . currentUnit . value } > ${ ( lidar . xPos * sceneManager . currentUnit . value ) . toFixed ( 2 ) } </strong><span data-unittext=${ sceneManager . currentUnit . value } > ${ sceneManager . currentUnit . label } </span></p>
46
46
</div>
47
47
<div>
48
- <p id="lidar-z-pos-` + lidar . id + ` " class="draggable">Pos. Z <strong data-unit=` + sceneManager . currentUnit . value + `>` + Math . round ( lidar . zPos * sceneManager . currentUnit . value * 100 ) / 100.0 + ` </strong><span data-unittext=` + sceneManager . currentUnit . value + `>` + sceneManager . currentUnit . label + ` </span></p>
48
+ <p id="lidar-z-pos-${ lidar . id } " class="draggable">Pos. Z <strong data-unit=${ sceneManager . currentUnit . value } > ${ ( lidar . zPos * sceneManager . currentUnit . value ) . toFixed ( 2 ) } </strong><span data-unittext=${ sceneManager . currentUnit . value } > ${ sceneManager . currentUnit . label } </span></p>
49
49
</div>
50
50
<div>
51
- <p id="lidar-y-rot-` + lidar . id + ` " class="draggable">Rot. Y <strong>` + Math . round ( lidar . yRot * 180 / Math . PI ) + ` </strong>° </p>
51
+ <p id="lidar-y-rot-${ lidar . id } " class="draggable">Rot. Y <strong>${ Math . round ( lidar . yRot * 180 / Math . PI ) } </strong>° </p>
52
52
</div>
53
53
</div>
54
54
<div class="row cam-spec">
55
55
<p class="spec-title main-text">Angular</p>
56
- <p>FOV</p><p id="lidar-fov` + lidar . id + `">` + lidar . lidarType . fov + ` °</p>
57
- <p>Res</p><p id="lidar-res` + lidar . id + `">` + lidar . lidarType . angularResolution + ` °</p>
56
+ <p>FOV</p><p id="lidar-fov${ lidar . id } "> ${ lidar . lidarType . fov } °</p>
57
+ <p>Res</p><p id="lidar-res${ lidar . id } "> ${ lidar . lidarType . angularResolution } °</p>
58
58
</div>
59
59
<div class="row cam-spec">
60
60
<p class="spec-title main-text">Distance</p>
61
- <p>Near</p><p><span id="lidar-near` + lidar . id + ` " data-unit=` + sceneManager . currentUnit . value + `>` + ( Math . round ( lidar . lidarType . rangeNear * sceneManager . currentUnit . value * 100 ) / 100.0 ) + ` </span> <span data-unittext=` + sceneManager . currentUnit . value + `>` + sceneManager . currentUnit . label + ` </span></p>
62
- <p>Far</p><p><span id="lidar-far` + lidar . id + ` " data-unit=` + sceneManager . currentUnit . value + `>` + ( Math . round ( lidar . lidarType . rangeFar * sceneManager . currentUnit . value * 100 ) / 100.0 ) + ` </span> <span data-unittext=` + sceneManager . currentUnit . value + `>` + sceneManager . currentUnit . label + ` </span></p>
61
+ <p>Near</p><p><span id="lidar-near${ lidar . id } " data-unit=${ sceneManager . currentUnit . value } > ${ ( lidar . lidarType . rangeNear * sceneManager . currentUnit . vale ) . toFixed ( 2 ) } </span> <span data-unittext=${ sceneManager . currentUnit . value } > ${ sceneManager . currentUnit . label } </span></p>
62
+ <p>Far</p><p><span id="lidar-far${ lidar . id } " data-unit=${ sceneManager . currentUnit . value } > ${ ( lidar . lidarType . rangeFar * sceneManager . currentUnit . vale ) . toFixed ( 2 ) } </span> <span data-unittext=${ sceneManager . currentUnit . value } > ${ sceneManager . currentUnit . label } </span></p>
63
63
</div>
64
64
</div>` ;
65
65
@@ -73,16 +73,16 @@ class LidarUI{
73
73
74
74
function bindEventListeners ( )
75
75
{
76
- makeElementDraggable ( document . getElementById ( " lidar-x-pos-" + lidar . id ) ) ;
77
- makeElementDraggable ( document . getElementById ( " lidar-z-pos-" + lidar . id ) ) ;
78
- makeElementDraggable ( document . getElementById ( " lidar-y-rot-" + lidar . id ) ) ;
76
+ makeElementDraggable ( document . getElementById ( ` lidar-x-pos-${ lidar . id } ` ) ) ;
77
+ makeElementDraggable ( document . getElementById ( ` lidar-z-pos-${ lidar . id } ` ) ) ;
78
+ makeElementDraggable ( document . getElementById ( ` lidar-y-rot-${ lidar . id } ` ) ) ;
79
79
80
80
81
- document . getElementById ( ' lidar-' + ( lidar . id ) + ' -hide-UI' ) . addEventListener ( 'click' , ( ) => hideUILidar ( ) ) ;
82
- document . getElementById ( ' lidar-' + ( lidar . id ) + ' -visible' ) . addEventListener ( 'click' , ( ) => lidar . changeVisibility ( ) ) ;
83
- document . getElementById ( ' lidar-' + ( lidar . id ) + ' -delete' ) . addEventListener ( 'click' , ( ) => sceneManager . objects . removeLidar ( lidar ) ) ;
81
+ document . getElementById ( ` lidar-${ lidar . id } -hide-UI` ) . addEventListener ( 'click' , ( ) => hideUILidar ( ) ) ;
82
+ document . getElementById ( ` lidar-${ lidar . id } -visible` ) . addEventListener ( 'click' , ( ) => lidar . changeVisibility ( ) ) ;
83
+ document . getElementById ( ` lidar-${ lidar . id } -delete` ) . addEventListener ( 'click' , ( ) => sceneManager . objects . removeLidar ( lidar ) ) ;
84
84
85
- document . getElementById ( ' lidar-type-' + lidar . id ) . addEventListener ( 'change' , ( ) => changeLidarType ( ) ) ;
85
+ document . getElementById ( ` lidar-type-${ lidar . id } ` ) . addEventListener ( 'change' , ( ) => changeLidarType ( ) ) ;
86
86
}
87
87
88
88
function makeElementDraggable ( element ) {
@@ -202,11 +202,11 @@ class LidarUI{
202
202
203
203
function hideUILidar ( )
204
204
{
205
- const lidarInfosUI = document . getElementById ( ' lidar-infos-' + ( lidar . id ) + ' -UI' ) ;
206
- const lidarUIheader = document . getElementById ( ' lidar-' + ( lidar . id ) + ' -UI-header' ) ;
205
+ const lidarInfosUI = document . getElementById ( ` lidar-infos-${ lidar . id } -UI` ) ;
206
+ const lidarUIheader = document . getElementById ( ` lidar-${ lidar . id } -UI-header` ) ;
207
207
const hidden = lidarInfosUI . classList . contains ( 'hidden' ) ;
208
208
hidden ? lidarInfosUI . classList . remove ( 'hidden' ) : lidarInfosUI . classList . add ( 'hidden' ) ;
209
- const iconElem = document . getElementById ( ' lidar-' + ( lidar . id ) + ' -hide-UI' ) . firstChild ;
209
+ const iconElem = document . getElementById ( ` lidar-${ lidar . id } -hide-UI` ) . firstChild ;
210
210
iconElem . dataset . icon = hidden ? "bx:minus" : "bx:plus" ;
211
211
}
212
212
@@ -226,29 +226,29 @@ class LidarUI{
226
226
lidar . buildRays ( ) ;
227
227
sceneManager . scene . add ( lidar . rays ) ;
228
228
229
- document . getElementById ( ' lidar-fov' + lidar . id ) . innerHTML = lidar . lidarType . fov + '°' ;
230
- document . getElementById ( ' lidar-res' + lidar . id ) . innerHTML = lidar . lidarType . angularResolution + '°' ;
231
- document . getElementById ( ' lidar-near' + lidar . id ) . innerHTML = ( Math . round ( lidar . lidarType . rangeNear * document . getElementById ( 'lidar-near' + lidar . id ) . dataset . unit * 100 ) / 100.0 ) ;
232
- document . getElementById ( ' lidar-far' + lidar . id ) . innerHTML = ( Math . round ( lidar . lidarType . rangeFar * document . getElementById ( 'lidar-far' + lidar . id ) . dataset . unit * 100 ) / 100.0 ) ;
229
+ document . getElementById ( ` lidar-fov${ lidar . id } ` ) . innerHTML = lidar . lidarType . fov + '°' ;
230
+ document . getElementById ( ` lidar-res${ lidar . id } ` ) . innerHTML = lidar . lidarType . angularResolution + '°' ;
231
+ document . getElementById ( ` lidar-near${ lidar . id } ` ) . innerHTML = ( Math . round ( lidar . lidarType . rangeNear * document . getElementById ( 'lidar-near' + lidar . id ) . dataset . unit * 100 ) / 100.0 ) ;
232
+ document . getElementById ( ` lidar-far${ lidar . id } ` ) . innerHTML = ( Math . round ( lidar . lidarType . rangeFar * document . getElementById ( 'lidar-far' + lidar . id ) . dataset . unit * 100 ) / 100.0 ) ;
233
233
234
234
sceneManager . objects . populateStorage ( ) ;
235
235
}
236
236
237
237
this . changeVisibilityUIOnly = function ( visible )
238
238
{
239
- const iconElem = document . getElementById ( ' lidar-' + ( lidar . id ) + ' -visible' ) . firstElementChild ;
239
+ const iconElem = document . getElementById ( ` lidar-${ lidar . id } -visible` ) . firstElementChild ;
240
240
iconElem . dataset . icon = visible ? "akar-icons:eye-open" : "akar-icons:eye-slashed" ;
241
241
}
242
242
243
243
this . updatePosition = function ( x , z , currentUnitValue )
244
244
{
245
- document . getElementById ( ' lidar-x-pos-' + lidar . id ) . getElementsByTagName ( 'strong' ) [ 0 ] . innerHTML = Math . round ( x * currentUnitValue * 100 ) / 100.0 ;
246
- document . getElementById ( ' lidar-z-pos-' + lidar . id ) . getElementsByTagName ( 'strong' ) [ 0 ] . innerHTML = Math . round ( z * currentUnitValue * 100 ) / 100.0 ;
245
+ document . getElementById ( ` lidar-x-pos-${ lidar . id } ` ) . getElementsByTagName ( 'strong' ) [ 0 ] . innerHTML = Math . round ( x * currentUnitValue * 100 ) / 100.0 ;
246
+ document . getElementById ( ` lidar-z-pos-${ lidar . id } ` ) . getElementsByTagName ( 'strong' ) [ 0 ] . innerHTML = Math . round ( z * currentUnitValue * 100 ) / 100.0 ;
247
247
}
248
248
249
249
this . dispose = function ( )
250
250
{
251
- let lidarUI = document . getElementById ( ' lidar-' + lidar . id + ' -UI' ) ;
251
+ let lidarUI = document . getElementById ( ` lidar-${ lidar . id } -UI` ) ;
252
252
//Check if wasn't removed singularly yet
253
253
if ( lidarUI ) lidarUI . remove ( ) ;
254
254
}
0 commit comments