@@ -581,39 +581,7 @@ class Popup{
581
581
582
582
//New hardware selection system
583
583
document . getElementById ( "multi-select-sensors" ) . addEventListener ( 'change' , ( ) => {
584
- const sensorTextId = document . getElementById ( "multi-select-sensors" ) . value ;
585
- //on click on a sensor, display the scene calculated with this sensor
586
- switch ( trackingMode )
587
- {
588
- case 'wall-tracking' :
589
- {
590
- const sensor = getLidarsTypes ( ) . find ( sensorType => sensorType . textId === sensorTextId ) ;
591
- const config = calculateLidarConfig ( sensor , givenWidth , givenHeight ) ;
592
- if ( ! config ) {
593
- console . error ( 'no config found with this setup' ) ;
594
- return ;
595
- }
596
- sceneManager . objects . removeSensors ( ) ;
597
- createSceneFromLidarConfig ( config , sceneManager ) ;
598
- break ;
599
- }
600
- case 'human-tracking' :
601
- case 'hand-tracking' :
602
- {
603
- const sensor = getCamerasTypes ( ) . find ( sensorType => sensorType . textId === sensorTextId ) ;
604
- const overlapHeightDetection = trackingMode === 'human-tracking' ? SceneManager . DEFAULT_DETECTION_HEIGHT : SceneManager . HAND_TRACKING_OVERLAP_HEIGHT ;
605
- const config = calculateCameraConfig ( trackingMode , sensor , givenWidth , givenLength , givenHeight , overlapHeightDetection ) ;
606
- if ( ! config ) {
607
- console . error ( 'no config found with this setup' ) ;
608
- return ;
609
- }
610
- sceneManager . objects . removeSensors ( ) ;
611
- createSceneFromCameraConfig ( config , trackingMode , givenWidth , givenLength , givenHeight + sceneManager . sceneElevation , sceneManager ) ;
612
- break ;
613
- }
614
- default :
615
- break ;
616
- }
584
+ createSceneFromSelectedSensor ( ) ;
617
585
} ) ;
618
586
619
587
//Old selection system
@@ -666,6 +634,42 @@ class Popup{
666
634
// }
667
635
}
668
636
637
+ function createSceneFromSelectedSensor ( ) {
638
+ const sensorTextId = document . getElementById ( "multi-select-sensors" ) . value ;
639
+ //on click on a sensor, display the scene calculated with this sensor
640
+ switch ( trackingMode )
641
+ {
642
+ case 'wall-tracking' :
643
+ {
644
+ const sensor = getLidarsTypes ( ) . find ( sensorType => sensorType . textId === sensorTextId ) ;
645
+ const config = calculateLidarConfig ( sensor , givenWidth , givenHeight ) ;
646
+ if ( ! config ) {
647
+ console . error ( 'no config found with this setup' ) ;
648
+ return ;
649
+ }
650
+ sceneManager . objects . removeSensors ( ) ;
651
+ createSceneFromLidarConfig ( config , sceneManager ) ;
652
+ break ;
653
+ }
654
+ case 'human-tracking' :
655
+ case 'hand-tracking' :
656
+ {
657
+ const sensor = getCamerasTypes ( ) . find ( sensorType => sensorType . textId === sensorTextId ) ;
658
+ const overlapHeightDetection = trackingMode === 'human-tracking' ? SceneManager . DEFAULT_DETECTION_HEIGHT : SceneManager . HAND_TRACKING_OVERLAP_HEIGHT ;
659
+ const config = calculateCameraConfig ( trackingMode , sensor , givenWidth , givenLength , givenHeight , overlapHeightDetection ) ;
660
+ if ( ! config ) {
661
+ console . error ( 'no config found with this setup' ) ;
662
+ return ;
663
+ }
664
+ sceneManager . objects . removeSensors ( ) ;
665
+ createSceneFromCameraConfig ( config , trackingMode , givenWidth , givenLength , givenHeight + sceneManager . sceneElevation , sceneManager ) ;
666
+ break ;
667
+ }
668
+ default :
669
+ break ;
670
+ }
671
+ }
672
+
669
673
function disableSensorsConsideringEnvironment ( environment )
670
674
{
671
675
let disabledSensorsNumber = 0 ;
@@ -705,6 +709,11 @@ class Popup{
705
709
706
710
function selectFirstSensorAvailable ( )
707
711
{
712
+ const sensorsDiv = document . getElementById ( 'multi-select-sensors' ) ;
713
+ if ( ! sensorsDiv ) return ;
714
+ sensorsDiv . value = sensorsDiv . children [ 0 ] . value ;
715
+ createSceneFromSelectedSensor ( ) ;
716
+ //Old way
708
717
// const sensorsDiv = document.getElementById('hardware-sensors-selection');
709
718
// for(let i = 0; i < sensorsDiv.children.length; i++)
710
719
// {
0 commit comments