Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I'd like to call the function below base on the visibility of an image but i am unaware of how to do this. Could someone help please?
$scope.intro = function() { var labelText = $scope.view.wdg['checkstart'].text; var spokenText = labelText.substr(labelText.indexOf(" ") + 1); $scope.app.speech.synthesizeSpeech({ 'text': spokenText }); }
Thanks
Solved! Go to Solution.
It depends on what you mean by "visability".
If you mean "when the visability parameter is set to true", then yes, you can do that using $scope.$watch, something like this:
$scope.$watch('view.wdg["image-1"].visible', function (val) { if (val) { $scope.intro(); } }
However, if you mean "when the user moves their device around so the image enters their field of view", then I think the answer is no. I don't think there's a way to detect whether an object is in the viewport or not. (I would be happy to be proven wrong, if there is a way to do this!) I also don't know of a way to get the location of the camera relative to the 3D view origin, so you can't try to derive it that way.
It depends on what you mean by "visability".
If you mean "when the visability parameter is set to true", then yes, you can do that using $scope.$watch, something like this:
$scope.$watch('view.wdg["image-1"].visible', function (val) { if (val) { $scope.intro(); } }
However, if you mean "when the user moves their device around so the image enters their field of view", then I think the answer is no. I don't think there's a way to detect whether an object is in the viewport or not. (I would be happy to be proven wrong, if there is a way to do this!) I also don't know of a way to get the location of the camera relative to the 3D view origin, so you can't try to derive it that way.