File tree Expand file tree Collapse file tree
Sources/Interaction/Style/InteractorStyleHMDXR/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,9 @@ import GUI from 'lil-gui';
2929// Dynamically load WebXR polyfill from CDN for WebVR and Cardboard API backwards compatibility
3030if ( navigator . xr === undefined ) {
3131 vtkResourceLoader
32- . loadScript ( 'https://esm.sh/webxr-polyfill@latest/build/webxr-polyfill.js' )
32+ . loadScript (
33+ 'https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js'
34+ )
3335 . then ( ( ) => {
3436 // eslint-disable-next-line no-new, no-undef
3537 new WebXRPolyfill ( ) ;
@@ -105,7 +107,7 @@ const gui = new GUI();
105107let button ;
106108const params = {
107109 toggleVR : ( ) => {
108- if ( ! XRHelper . isXRSessionActive ( ) ) {
110+ if ( XRHelper . getXrSession ( ) === null ) {
109111 XRHelper . startXR ( XrSessionTypes . HmdVR ) ;
110112 button . name ( 'Exit VR' ) ;
111113 } else {
@@ -117,9 +119,6 @@ const params = {
117119
118120button = gui . add ( params , 'toggleVR' ) . name ( 'Start VR' ) ;
119121
120- XRHelper . onSessionStarted ( ( ) => button . name ( 'Exit VR' ) ) ;
121- XRHelper . onSessionEnded ( ( ) => button . name ( 'Start VR' ) ) ;
122-
123122// -----------------------------------------------------------
124123// Make some variables global so that you can inspect and
125124// modify objects in your browser's developer console:
You can’t perform that action at this time.
0 commit comments