소스 검색

DeviceOrientationControls: Add isSecureContext check. (#21528)

Michael Herzog 4 년 전
부모
커밋
56ca942a56
2개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      examples/js/controls/DeviceOrientationControls.js
  2. 6 0
      examples/jsm/controls/DeviceOrientationControls.js

+ 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;