3D-Guided Service Instructions shader and iphone problem
Dear support team,
After clicking on a part like the rotor in the 3D-Guided Service Instructions demo experience, it gets highlighted green, but after that goes away it looks shinier. Why does it not go back to "normal"
I have tried to adapt the on click ionic popup for a customer experience, but it does not work in view app, it only works in the preview. What could be the problem there? I am using a Iphone SE 2. I can't share the experience right now because of a non disclosure contract. This is the code I'm using:
// $scope, $element, $attrs, $injector, $sce, $timeout, $http, $ionicPopup, and $ionicPopover services are available
// triggered when user clicks on object in the scene
$scope.$on('userpick', function (event, targetName, targetType, eventData) {
//
//Look at model and see if it has metadata. If it does, then execute the below code and create an object called metadata
PTC.Metadata.fromId(targetName)
.then((metadata) => {
//
// variable to pull the value for the occurrence property in the eventData JSON object from the model. Create variable for the currently selected part
var pathId = JSON.parse(eventData).occurrence
$scope.currentSelection = targetName + "-" + pathId
//
// create variables based on attribute names from Creo Illustrate for this model. use metadata.get to obtain the data from the JSON properties for this occurrence.
var partNumber = metadata.get(pathId, 'Display Name');
//
// adds an ionic popup when a part is clicked. Show the part number and name of the selected object. </br> adds a line break between the two variables
var popup = $ionicPopup.show({
template: '<div>' + partNumber + '</div>',
scope: $scope
}); //end of ionic popup
//
//highlight the chosen item and set the shader to true
$scope.hilite([$scope.currentSelection], true);
//
// create a function to close the popup and turn off shading. popup is the popup, refitems is the input for the part(s) that is being highlighted
var closePopup = function (popup, refitems) {
//
//The function returns a method for removing the popup from the screen and turns off the shader
return function () {
//
//using the input parts, set the hilite function to be false, removing the shading
$scope.hilite(refitems, false)
//
//apply the .close method, which removes a certain section of a selected object, to the popup variable
popup.close()
} //return end
} // closepopup function end
//
//call the $timeout service which will call the function for closing the popup after 3 seconds (3000 ms)
$timeout(closePopup(popup, [$scope.currentSelection]), 3000);
}) //end brackets for PTC API and .then
//
//catch statement if the promise of having a part with metadata is not met
.catch((err) => { console.log('metadata extraction failed with reason : ' + err) })
}) //end brackets for userpick function. Will continue to move throughout code
// highlighting function. Inputs are the selected part and a boolean for hilite
$scope.hilite = function (items, hilite) {
//
//iterate over each item that is used as an imported variable for the function using .forEach to look at each value that comes in the items input
items.forEach(function (item) {
//
//set the properties of the TML 3D Renderer to highlight the selected item using a TML Text shader. "green" is the name of the script for the TML Text.
tml3dRenderer.setProperties(item, hilite === true ? { shader: "green", hidden: false, opacity: 0.9, phantom: false, decal: true }
: { shader: "Default", hidden: false, opacity: 1.0, phantom: false, decal: false });
}) //foreach end
} //hilite function end
Best wishes,
Alex

