Skip to main content
1-Visitor
February 19, 2021
Question

Display 3D label by clicking on the previous label

  • February 19, 2021
  • 1 reply
  • 855 views

Hi,

 

I have almost 20 steps which using 3D Label in 3D eyewear view. I want to show some labels which on clicking will show other labels.

 

For example, when I click on the Step 1 label, the Step 2 label will be displayed. Then, when I clicked on Step 2 label, the Step 3 label will be displayed. And it will repeat the same process until the last step which is step 20 label displayed. 

 

Do I need to use below code for all 20 steps? Means that, I have to copy and paste the same code with different function name?

 

$scope.showLabel=function() 
{
 
 $scope.view.wdg['3DLabel-2']['visible'] = true;
 
}

 

Is there any other simple solution that I can use instead of copying and pasting the same code?

 

Thank you in advance. 

1 reply

16-Pearl
February 19, 2021

Maybe you can try using Array.

const allLabels = ['', '3DLabel-1', '3DLabel-2', '3DLabel-3', '3DLabel-4', '3DLabel-5']
$scope.showLabel = function(num){
 $scope.view.wdg[allLabels[num]].visible = true;
}

showLabel(1)  > show '3DLabel-1' 

showLabel(2)  > show '3DLabel-2'