Explorar el Código

Fix yaw out of bounds in `mouseEventToCoords`.

If `config.yaw` is close to -180 or 180, `yaw` might be out of bounds.
pull/452/head
Tortila90 hace 7 años
committed by Matthew Petroff
padre
commit
7c162a039c
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. +4
    -0
      src/js/pannellum.js

+ 4
- 0
src/js/pannellum.js Ver fichero

@@ -704,6 +704,10 @@ 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];
}



Cargando…
Cancelar
Guardar