Skip to content

Commit 7c22977

Browse files
author
Léna Voinchet
committed
Add Table height
1 parent 141f54f commit 7c22977

File tree

8 files changed

+99
-74
lines changed

8 files changed

+99
-74
lines changed

css/main.css

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -907,14 +907,14 @@ textarea:focus {
907907
color: var(--color-green-y);
908908
}
909909

910-
/*#dimensions-table-height-input{
911-
caret-color: var(--color-grey-unselected);
912-
border-color: var(--color-grey-unselected) var(--color-grey-unselected) var(--color-grey-unselected) var(--color-grey-unselected);
910+
#dimensions-table-height-input{
911+
caret-color: var(--color-blue-z);
912+
border-color: var(--color-grey-unselected) var(--color-grey-unselected) var(--color-grey-unselected) var(--color-blue-z);
913913
}
914914

915915
#dimensions-table-height-text{
916-
color: var(--color-grey-unselected);
917-
}*/
916+
color: var(--color-blue-z);
917+
}
918918

919919
#dimensions-distance-input{
920920
caret-color: var(--color-blue-z);
@@ -925,25 +925,6 @@ textarea:focus {
925925
color: var(--color-blue-z);
926926
}
927927

928-
#dimensions-distance-text-hand-tracking svg{
929-
padding: 0 0 0 4px;
930-
}
931-
932-
#sensor-height-infos-text{
933-
background-color: var(--color-grey);
934-
max-width: 150px;
935-
padding: 10px;
936-
border-radius: 5px;
937-
position: absolute;
938-
z-index:10;
939-
}
940-
941-
#sensor-height-infos-text p{
942-
color: var(--color-dark-purple);
943-
padding: 0;
944-
margin:0;
945-
}
946-
947928
/** HARDWARES SECTION **/
948929
#hardware-section-builder{
949930
padding-bottom: 2%;

index.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,20 @@ <h3>Hardware</h3>
139139
<div id="dimensions-distance" class="column">
140140
<div class="column">
141141
<p id="dimensions-distance-text-default">Sensor height (<span data-unittext="1">m</span>)</p>
142-
<p id="dimensions-distance-text-hand-tracking" class="hidden">Sensor height (<span data-unittext="1">m</span>) <span id="sensor-height-infos" class="iconify" data-icon="el:info-circle"></span></p>
143-
<div id="sensor-height-infos-text" class="hidden">
144-
<p>Please indicate the distance between the sensor and the table.</p>
145-
</div>
146142
<p id="dimensions-distance-text-wall-tracking" class="hidden">Height (<span data-unittext="1">m</span>)</p>
147143
</div>
148144
<div class="column">
149145
<input id="dimensions-distance-input" type="text" placeholder="Sensor height" min="0" max="20" step="0.1" data-unit="1">
150146
</div>
151147
</div>
152-
<!--<div id="dimensions-table-height" class="column">
148+
<div id="dimensions-table-height" class="column">
153149
<div class="column">
154150
<p id="dimensions-table-height-text">Table height (<span data-unittext="1">m</span>)</p>
155151
</div>
156152
<div class="column">
157-
<input id="dimensions-table-height-input" type="text" placeholder="Width" min="0" max="2" step="0.1" data-unit="1">
153+
<input id="dimensions-table-height-input" type="text" placeholder="Table height" min="0" max="2" step="0.1" data-unit="1">
158154
</div>
159-
</div>-->
155+
</div>
160156
</div>
161157
<div id="new-toggle">
162158
<p id="button-toggle-unit">METERS</p>

js/UI/Popup.js

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class Popup{
112112
document.getElementById("setup-target-overlap").classList.add("hidden");
113113
document.getElementById("setup-target-overlap-wall").classList.add("hidden");
114114
sceneManager.heightDetectedObservable.set(0.25);
115+
//sceneManager.sceneElevation = 0.75;
115116
break;
116117
case 'human-tracking':
117118
document.getElementById("setup-target-overlap").classList.remove("hidden");
@@ -236,7 +237,6 @@ class Popup{
236237

237238
document.getElementById('dimensions-length').classList.remove('hidden');
238239
document.getElementById('dimensions-distance-text-default').classList.remove('hidden');
239-
document.getElementById('dimensions-distance-text-hand-tracking').classList.add('hidden');
240240
document.getElementById('dimensions-distance-text-wall-tracking').classList.add('hidden');
241241
document.getElementById('dimensions-distance-input').placeholder = `Sensor height`;
242242

@@ -246,25 +246,20 @@ class Popup{
246246
document.getElementById('dimensions-width-input').addEventListener('change', onChangeDimensionsInput);
247247
document.getElementById('dimensions-length-input').addEventListener('change', onChangeDimensionsInput);
248248
document.getElementById('dimensions-distance-input').addEventListener('change', onChangeDimensionsInput);
249-
250-
document.getElementById('sensor-height-infos').addEventListener('mouseover', (e) =>
251-
{
252-
const infosText = document.getElementById('sensor-height-infos-text');
253-
infosText.style.left = (e.clientX - 180).toString() + "px";
254-
infosText.style.top = (e.clientY - 130).toString() + "px";
255-
infosText.classList.remove('hidden');
256-
});
257-
document.getElementById('sensor-height-infos').addEventListener('mouseleave', () => document.getElementById('sensor-height-infos-text').classList.add('hidden'));
249+
document.getElementById('dimensions-table-height-input').addEventListener('change', onChangeDimensionsInput);
258250

259251
function onChangeDimensionsInput()
260252
{
261253
const inputSceneWidth = parseFloat(document.getElementById('dimensions-width-input').value);
262254
const inputSceneLength = parseFloat(document.getElementById('dimensions-length-input').value);
263255
const inputSceneHeight = parseFloat(document.getElementById('dimensions-distance-input').value);
256+
const inputSceneElevation = parseFloat(document.getElementById('dimensions-table-height-input').value) || 0;
264257

265258
const givenSceneWidth = Math.floor(parseFloat(inputSceneWidth) / sceneManager.currentUnit.value * 100) / 100;
266259
const givenSceneLength = Math.floor(parseFloat(inputSceneLength) / sceneManager.currentUnit.value * 100) / 100;
267260
const givenSceneHeight = Math.floor(parseFloat(inputSceneHeight) / sceneManager.currentUnit.value * 100) / 100;
261+
262+
main.uiManager.changeTrackingMode(trackingMode);
268263

269264
//CHECK INPUT COHERENCE
270265
if(trackingMode === "wall-tracking" && inputSceneWidth && inputSceneHeight)
@@ -274,7 +269,7 @@ class Popup{
274269
document.getElementById('dimensions-negative-values-warning').classList.add('hidden');
275270
if(checkLidarCoherence(givenSceneWidth, givenSceneHeight, getMaxFarFromSensors(getLidarsTypes().filter(l => l.recommended), trackingMode)))
276271
{
277-
sceneManager.updateWallYAugmentaSceneBorder(inputSceneWidth, inputSceneHeight);
272+
sceneManager.updateWallYAugmentaSceneBorder(inputSceneWidth, inputSceneHeight, 0);
278273

279274
// update inspector infos
280275
document.getElementById('input-wall-y-scene-width-inspector').value = inputSceneWidth;
@@ -302,7 +297,8 @@ class Popup{
302297
if(inputSceneWidth > 0 && inputSceneLength > 0)
303298
{
304299
document.getElementById('dimensions-negative-values-warning').classList.add('hidden');
305-
sceneManager.updateFloorAugmentaSceneBorder(inputSceneWidth, inputSceneLength);
300+
sceneManager.sceneElevation = (trackingMode === "human-tracking") ? 0 : inputSceneElevation;
301+
sceneManager.updateFloorAugmentaSceneBorder(inputSceneWidth, inputSceneLength, sceneManager.sceneElevation);
306302
//update inspector
307303
document.getElementById('input-scene-width-inspector').value = inputSceneWidth;
308304
document.getElementById('input-scene-length-inspector').value = inputSceneLength;
@@ -320,10 +316,9 @@ class Popup{
320316
const maxFar = getMaxFarFromSensors(camerasTypesRecommended, trackingMode);
321317
const minNear = getMinNearFromSensors(camerasTypesRecommended);
322318

323-
if(checkCameraCoherence(givenSceneHeight, overlapHeightDetection, maxFar, minNear))
319+
if(checkCameraCoherence(givenSceneHeight - sceneManager.sceneElevation, overlapHeightDetection, maxFar, minNear))
324320
{
325-
const convertedSceneHeight = inputSceneHeight / sceneManager.currentUnit.value;
326-
sceneManager.sceneSensorHeight = convertedSceneHeight;
321+
sceneManager.sceneSensorHeight = givenSceneHeight;
327322
const warningElem = document.getElementById('warning-hook-height');
328323
if(warningElem) document.getElementById('surface-warning-message').classList.add('hidden');
329324
//update inspector
@@ -341,7 +336,25 @@ class Popup{
341336
const newWarningElem = document.createElement("p");
342337
newWarningElem.classList.add("warning-text");
343338
newWarningElem.id = 'warning-hook-height';
344-
newWarningElem.innerHTML = `The camera(s) you chose cannot see your tracking surface at this distance (min = <span data-unit=` + sceneManager.currentUnit.value + `>` + (Math.round(((minNear + overlapHeightDetection) * sceneManager.currentUnit.value) * 100) / 100.0) + `</span> <span data-unittext=` + sceneManager.currentUnit.label + `>` + sceneManager.currentUnit.label + `</span>, max = <span data-unit=` + sceneManager.currentUnit.value + `>` + (Math.round((maxFar * sceneManager.currentUnit.value) * 100) / 100.0) + `</span> <span data-unittext=` + sceneManager.currentUnit.label + `>` + sceneManager.currentUnit.label + `</span>)`;
339+
//newWarningElem.innerHTML = `The camera(s) you chose cannot see your tracking surface at this distance (min = <span data-unit=` + sceneManager.currentUnit.value + `>` + (Math.round(((minNear + overlapHeightDetection) * sceneManager.currentUnit.value) * 100) / 100.0) + `</span> <span data-unittext=` + sceneManager.currentUnit.label + `>` + sceneManager.currentUnit.label + `</span>, max = <span data-unit=` + sceneManager.currentUnit.value + `>` + (Math.round((maxFar * sceneManager.currentUnit.value) * 100) / 100.0) + `</span> <span data-unittext=` + sceneManager.currentUnit.label + `>` + sceneManager.currentUnit.label + `</span>)`;
340+
newWarningElem.innerHTML = `
341+
The camera(s) you chose cannot see your tracking surface at this distance
342+
(min =
343+
<span data-unit="${sceneManager.currentUnit.value}">
344+
${( (minNear + overlapHeightDetection) * sceneManager.currentUnit.value ).toFixed(2)}
345+
</span>
346+
<span data-unittext="${sceneManager.currentUnit.label}">
347+
${sceneManager.currentUnit.label}
348+
</span>,
349+
max =
350+
<span data-unit="${sceneManager.currentUnit.value}">
351+
${( maxFar * sceneManager.currentUnit.value ).toFixed(2)}
352+
</span>
353+
<span data-unittext="${sceneManager.currentUnit.label}">
354+
${sceneManager.currentUnit.label}
355+
</span>
356+
)
357+
`;
345358
document.getElementById('surface-warning-message').appendChild(newWarningElem);
346359
}
347360
resetWarnings();
@@ -363,10 +376,15 @@ class Popup{
363376

364377
function initDimensionsSection()
365378
{
379+
if(trackingMode === "human-tracking")
380+
{
381+
document.getElementById('dimensions-table-height').classList.add('hidden');
382+
}
383+
366384
if(trackingMode === "hand-tracking")
367385
{
368-
document.getElementById('dimensions-distance-text-default').classList.add('hidden');
369-
document.getElementById('dimensions-distance-text-hand-tracking').classList.remove('hidden');
386+
document.getElementById('dimensions-distance-text-default').classList.remove('hidden');
387+
document.getElementById('dimensions-table-height').classList.remove('hidden');
370388
}
371389

372390
if(trackingMode === "wall-tracking")
@@ -375,6 +393,7 @@ class Popup{
375393
document.getElementById('dimensions-distance-text-default').classList.add('hidden');
376394
document.getElementById('dimensions-distance-text-wall-tracking').classList.remove('hidden');
377395
document.getElementById('dimensions-distance-input').placeholder = `Height`;
396+
document.getElementById('dimensions-table-height').classList.add('hidden');
378397
}
379398

380399
if(trackingMode)
@@ -383,19 +402,20 @@ class Popup{
383402
if(sceneInfos)
384403
{
385404
const sceneSize = JSON.parse(sceneInfos).sceneSize;
405+
const sceneElevation = JSON.parse(sceneInfos).sceneElevation;
386406
switch(trackingMode)
387407
{
388408
case 'wall-tracking':
389409
document.getElementById('dimensions-width-input').value = Math.floor(sceneSize[0] * sceneManager.currentUnit.value * 100) / 100;
390410
document.getElementById('dimensions-distance-input').value = Math.floor(sceneSize[1] * sceneManager.currentUnit.value * 100) / 100;
391411
break;
392412
case 'hand-tracking':
413+
document.getElementById('dimensions-table-height-input').value = Math.floor(sceneElevation * sceneManager.currentUnit.value * 100) / 100;
393414
case 'human-tracking':
394415
document.getElementById('dimensions-width-input').value = Math.floor(sceneSize[0] * sceneManager.currentUnit.value * 100) / 100;
395416
document.getElementById('dimensions-length-input').value = Math.floor(sceneSize[1] * sceneManager.currentUnit.value * 100) / 100;
396417
const nodes = JSON.parse(sceneInfos).objects.nodes;
397-
//The value 4.5 for hand-tracking is just to address the fact that the sensor is by default the human-tracking one
398-
if(nodes.length > 0) document.getElementById('dimensions-distance-input').value = Math.floor((nodes[0].p_z - (trackingMode === 'hand-tracking' ? 4.5 : 0)) * sceneManager.currentUnit.value * 100) / 100;
418+
if(nodes.length > 0) document.getElementById('dimensions-distance-input').value = Math.floor((nodes[0].p_z) * sceneManager.currentUnit.value * 100) / 100;
399419
else document.getElementById('dimensions-distance-input').value = '';
400420
break;
401421
default:
@@ -520,8 +540,14 @@ class Popup{
520540
{
521541
getCamerasTypes().filter(c => c.recommended).forEach(c => {
522542
const overlapHeightDetection = trackingMode === 'human-tracking' ? heightDetected : SceneManager.HAND_TRACKING_OVERLAP_HEIGHT;
523-
if(checkCameraCoherence(givenHeight, overlapHeightDetection, trackingMode === 'hand-tracking' ? c.handFar : c.rangeFar, c.rangeNear))
524-
{ sensorsCompatible.push(c) }
543+
if(trackingMode === "hand-tracking")
544+
{
545+
if(checkCameraCoherence(givenHeight - sceneManager.sceneElevation, overlapHeightDetection, c.handFar, c.rangeNear))
546+
{ sensorsCompatible.push(c) }
547+
} else {
548+
if(checkCameraCoherence(givenHeight, overlapHeightDetection, c.rangeFar, c.rangeNear))
549+
{ sensorsCompatible.push(c) }
550+
}
525551
})
526552
}
527553

@@ -713,13 +739,13 @@ class Popup{
713739
{
714740
const sensor = getCamerasTypes().find(sensorType => sensorType.textId === sensorTextId);
715741
const overlapHeightDetection = trackingMode === 'human-tracking' ? heightDetected : SceneManager.HAND_TRACKING_OVERLAP_HEIGHT;
716-
const config = calculateCameraConfig(trackingMode, sensor, givenWidth, givenLength, givenHeight, overlapHeightDetection);
742+
const config = calculateCameraConfig(trackingMode, sensor, givenWidth, givenLength, givenHeight - sceneManager.sceneElevation, overlapHeightDetection);
717743
if(!config){
718744
console.error('no config found with this setup');
719745
return;
720746
}
721747
sceneManager.objects.removeSensors();
722-
createSceneFromCameraConfig(config, trackingMode, givenWidth, givenLength, givenHeight + sceneManager.sceneElevation, sceneManager);
748+
createSceneFromCameraConfig(config, trackingMode, givenWidth, givenLength, givenHeight, sceneManager);
723749
break;
724750
}
725751
default:

js/UI/UIManager.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class UIManager{
6565
document.getElementById("input-scene-width-inspector").addEventListener('change', () => sceneManager.updateAugmentaSceneBorder(parseFloat(document.getElementById("input-scene-width-inspector").value), parseFloat(document.getElementById("input-scene-length-inspector").value)));
6666
document.getElementById("input-scene-length-inspector").addEventListener('change', () => sceneManager.updateAugmentaSceneBorder(parseFloat(document.getElementById("input-scene-width-inspector").value), parseFloat(document.getElementById("input-scene-length-inspector").value)));
6767

68-
document.getElementById("input-wall-y-scene-width-inspector").addEventListener('change', () => sceneManager.updateWallYAugmentaSceneBorder(parseFloat(document.getElementById("input-wall-y-scene-width-inspector").value), parseFloat(document.getElementById("input-wall-y-scene-height-inspector").value)));
69-
document.getElementById("input-wall-y-scene-height-inspector").addEventListener('change', () => sceneManager.updateWallYAugmentaSceneBorder(parseFloat(document.getElementById("input-wall-y-scene-width-inspector").value), parseFloat(document.getElementById("input-wall-y-scene-height-inspector").value)));
68+
document.getElementById("input-wall-y-scene-width-inspector").addEventListener('change', () => sceneManager.updateWallYAugmentaSceneBorder(parseFloat(document.getElementById("input-wall-y-scene-width-inspector").value), parseFloat(document.getElementById("input-wall-y-scene-height-inspector").value),0));
69+
document.getElementById("input-wall-y-scene-height-inspector").addEventListener('change', () => sceneManager.updateWallYAugmentaSceneBorder(parseFloat(document.getElementById("input-wall-y-scene-width-inspector").value), parseFloat(document.getElementById("input-wall-y-scene-height-inspector").value),0));
7070

7171
document.getElementById('open-wizard-button').addEventListener('click', () => {
7272
if(sceneManager.augmentaSceneLoaded)
@@ -223,8 +223,7 @@ class UIManager{
223223

224224
const infoTableElemInspector = document.getElementById('info-table-height-inspector');
225225

226-
infoTableElemInspector.innerHTML = `<h3>The table is <span data-unit=1>` + SceneManager.TABLE_ELEVATION +`</span><span data-unittext=1>m</span> high</h3>`;
227-
226+
sceneManager.updateTableHeightText();
228227
infoTableElemInspector.classList.remove("hidden");
229228
break;
230229
case 'wall-tracking':

0 commit comments

Comments
 (0)