Browse Source

Replace button.textContent from VR NOT FOUND to XR NOT FOUND for WebXR API

Takahiro 6 years ago
parent
commit
0ce5b5b12f
1 changed files with 18 additions and 4 deletions
  1. 18 4
      examples/js/vr/WebVR.js

+ 18 - 4
examples/js/vr/WebVR.js

@@ -93,7 +93,7 @@ var WEBVR = {
 
 		}
 
-		function showVRNotFound() {
+		function disableButton() {
 
 			button.style.display = '';
 
@@ -101,17 +101,31 @@ var WEBVR = {
 			button.style.left = 'calc(50% - 75px)';
 			button.style.width = '150px';
 
-			button.textContent = 'VR NOT FOUND';
-
 			button.onmouseenter = null;
 			button.onmouseleave = null;
 
 			button.onclick = null;
 
+		}
+
+		function showVRNotFound() {
+
+			disableButton();
+
+			button.textContent = 'VR NOT FOUND';
+
 			renderer.vr.setDevice( null );
 
 		}
 
+		function showXRNotFound() {
+
+			disableButton();
+
+			button.textContent = 'XR NOT FOUND';
+
+		}
+
 		function stylizeElement( element ) {
 
 			element.style.position = 'absolute';
@@ -136,7 +150,7 @@ var WEBVR = {
 
 			stylizeElement( button );
 
-			navigator.xr.supportsSession( 'immersive-vr' ).then( showEnterXR ).catch( showVRNotFound );
+			navigator.xr.supportsSession( 'immersive-vr' ).then( showEnterXR ).catch( showXRNotFound );
 
 			return button;