Browse Source

Fix yaw out of bounds in mouseEventToCoords

If config.yaw is close to -180 or 180, yaw might be out of bounds.
pull/414/head
Tortila90 7 years ago
committed by GitHub
parent
commit
5e9de253ce
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/js/pannellum.js

+ 2
- 0
src/js/pannellum.js View File

@@ -704,6 +704,8 @@ function mouseEventToCoords(event) {
var root = Math.sqrt(x*x + a*a);
var pitch = Math.atan((y * c + focal * s) / root) * 180 / Math.PI;
var yaw = Math.atan2(x / root, a / root) * 180 / Math.PI + config.yaw;
if (yaw < -180) yaw += 360;
if (yaw > 180) yaw -= 360;
return [pitch, yaw];
}



Loading…
Cancel
Save