Bladeren bron

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

pull/132/merge
Matthew Petroff 7 jaren geleden
bovenliggende
commit
1d1a07a9bb
1 gewijzigde bestanden met toevoegingen van 3 en 1 verwijderingen
  1. +3
    -1
      src/js/pannellum.js

+ 3
- 1
src/js/pannellum.js Bestand weergeven

@@ -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);


Laden…
Annuleren
Opslaan