浏览代码

Don't change yaw when turning on device orientation mode.

pull/132/merge
Matthew Petroff 7 年前
父节点
当前提交
1d1a07a9bb
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      src/js/pannellum.js

+ 3
- 1
src/js/pannellum.js 查看文件

@@ -58,6 +58,7 @@ var config,
speed = {'yaw': 0, 'pitch': 0, 'hfov': 0},
animating = false,
orientation = false,
orientationYawOffset = 0,
autoRotateStart,
autoRotateSpeed = 0,
origHfov,
@@ -1498,7 +1499,7 @@ function orientationListener(e) {
var q = computeQuaternion(e.alpha, e.beta, e.gamma).toEulerAngles();
config.pitch = q[0] / Math.PI * 180;
config.roll = -q[1] / Math.PI * 180;
config.yaw = -q[2] / Math.PI * 180 + config.northOffset;
config.yaw = -q[2] / Math.PI * 180 + config.northOffset + orientationYawOffset;
}

/**
@@ -2174,6 +2175,7 @@ function stopOrientation() {
*/
function startOrientation() {
orientation = true;
orientationYawOffset = config.yaw;
window.addEventListener('deviceorientation', orientationListener);
controls.orientation.classList.add('pnlm-orientation-button-active');
requestAnimationFrame(animate);


正在加载...
取消
保存