Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleTouchMoveRotate( event ) {
console.log( 'handleTouchMoveRotate' );
rotateEnd.set(event.touches[0].pageX, event.touches[0].pageY);
rotateDelta.subVectors(rotateEnd, rotateStart);
rotateStart.copy(rotateEnd);
// On iOS, direction is inverted.
if (Util.isIOS()) {
//rotateDelta.x *= -1;
}
var orientation = scope.orientation;
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
orientation.x += 2 * Math.PI * rotateDelta.y / element.clientWidth * scope.rotateSpeed;
orientation.y += 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed;
//orientation.x = Math.max( - PI_2, Math.min( PI_2, orientation.x ) );
scope.update();
}
this.deviceMotion = new DeviceMotion();
this.accelerometer = new MathUtil.Vector3();
this.gyroscope = new MathUtil.Vector3();
this._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);
this._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);
this.filter = new ComplementaryFilter(K_FILTER);
this.posePredictor = new PosePredictor(PREDICTION_TIME_S);
this.filterToWorldQ = new MathUtil.Quaternion();
this.isFirefoxAndroid = Util.isFirefoxAndroid();
this.isIOS = Util.isIOS();
// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18
this.isChromeUsingDegrees = agentInfo.browser.name === "chrome" &&
parseInt(agentInfo.browser.version, 10) >= 66;
this._isEnabled = false;
// Set the filter to world transform, depending on OS.
if (this.isIOS) {
this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);
} else {
this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);
}
this.inverseWorldToScreenQ = new MathUtil.Quaternion();
this.worldToScreenQ = new MathUtil.Quaternion();