同步操作将从 入栈/TPano 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*** W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)*/THREE.DeviceOrientationControls = function ( object ) {var scope = this;var changeEvent = { type: 'change' };var EPS = 0.000001;this.object = object;this.object.rotation.reorder( 'YXZ' );this.enabled = true;this.deviceOrientation = {};this.screenOrientation = 0;this.alphaOffset = 0; // radiansvar onDeviceOrientationChangeEvent = function ( event ) {scope.deviceOrientation = event;};var onScreenOrientationChangeEvent = function () {scope.screenOrientation = window.orientation || 0;};// The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''var setObjectQuaternion = function () {var zee = new THREE.Vector3( 0, 0, 1 );var euler = new THREE.Euler();var q0 = new THREE.Quaternion();var q1 = new THREE.Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axisreturn function ( quaternion, alpha, beta, gamma, orient ) {euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for usquaternion.setFromEuler( euler ); // orient the devicequaternion.multiply( q1 ); // camera looks out the back of the device, not the topquaternion.multiply( q0.setFromAxisAngle( zee, - orient ) ); // adjust for screen orientation};}();this.connect = function () {onScreenOrientationChangeEvent(); // run once on load// iOS 13+if ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {window.DeviceOrientationEvent.requestPermission().then( function ( response ) {if ( response == 'granted' ) {window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent, false );window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent, false );}} ).catch( function ( error ) {console.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );} );} else {window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent, false );window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent, false );}scope.enabled = true;};this.disconnect = function () {window.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent, false );window.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent, false );scope.enabled = false;};this.update = ( function () {var lastQuaternion = new THREE.Quaternion();return function () {if ( scope.enabled === false ) return;var device = scope.deviceOrientation;if ( device ) {var alpha = device.alpha ? THREE.MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Zvar beta = device.beta ? THREE.MathUtils.degToRad( device.beta ) : 0; // X'var gamma = device.gamma ? THREE.MathUtils.degToRad( device.gamma ) : 0; // Y''var orient = scope.screenOrientation ? THREE.MathUtils.degToRad( scope.screenOrientation ) : 0; // OsetObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );if ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {lastQuaternion.copy( scope.object.quaternion );scope.dispatchEvent( changeEvent );}}};} )();this.dispose = function () {scope.disconnect();};this.connect();};THREE.DeviceOrientationControls.prototype = Object.create( THREE.EventDispatcher.prototype );THREE.DeviceOrientationControls.prototype.constructor = THREE.DeviceOrientationControls;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。