Ver Fonte

DeviceOrientationControls: Add isSecureContext check. (#21528)

Michael Herzog há 4 anos atrás
pai
commit
56ca942a56

+ 6 - 0
examples/js/controls/DeviceOrientationControls.js

@@ -4,6 +4,12 @@
 
 THREE.DeviceOrientationControls = function ( object ) {
 
+	if ( window.isSecureContext === false ) {
+
+		console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );
+
+	}
+
 	var scope = this;
 	var changeEvent = { type: 'change' };
 	var EPS = 0.000001;

+ 6 - 0
examples/jsm/controls/DeviceOrientationControls.js

@@ -12,6 +12,12 @@ import {
 
 var DeviceOrientationControls = function ( object ) {
 
+	if ( window.isSecureContext === false ) {
+
+		console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );
+
+	}
+
 	var scope = this;
 	var changeEvent = { type: 'change' };
 	var EPS = 0.000001;