Call the stopPresenting function like the activateAR function #4373
-
Hello, I can't find anything on calling the stopPresenting function in the same fassion as calling the activateAR function. The reason I want to stop the AR on click is that I want to have a button that closes AR and opens an overlay back on the "main page" without having to reload the page. I still need the Top right exit button for usability and i essentially want a second close button with extra functionality. Is there any way anyone has done/used a similar thing before? And also is there a way to create an overlay on top of the mv ar view without defining it inside the model-viewer? Giving it a real high z index didn't work and i could'nt figure out how the ar view is positioned in front of everything. Something on that would be amazing aswell. Thank you in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Oh and btw I am trying to call it like so |
Beta Was this translation helpful? Give feedback.
-
Ok I have figured out a workaround but I am very open to cleaner implementations
|
Beta Was this translation helpful? Give feedback.
Ok I have figured out a workaround but I am very open to cleaner implementations
function closeAR(button) { var modelViever = button.closest('model-viewer') var shadow = modelViever.shadowRoot; var element = shadow.querySelector('#default-exit-webxr-ar-button'); if (element) { element.click(); } else { console.error('Element not found: default-exit-webxr-ar-button'); } }