From 5cc12a0048a3bcc4a061034328ce1517b1ed7134 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Thu, 5 Mar 2015 20:26:30 -0500 Subject: [PATCH] Fix jumping while panning around +180/-180 degrees (fixes #62). --- src/js/pannellum.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 8a8c30e..a7870af 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -485,7 +485,7 @@ function onDocumentMouseMove(event) { latestInteraction = Date.now(); //TODO: This still isn't quite right var yaw = ((Math.atan(onPointerDownPointerX / renderer.canvas.width * 2 - 1) - Math.atan(event.clientX / renderer.canvas.width * 2 - 1)) * 180 / Math.PI * config.hfov / 90) + onPointerDownYaw; - yawSpeed = (yaw - config.yaw) * 0.2; + yawSpeed = (yaw - config.yaw) % 360 * 0.2; config.yaw = yaw; var vfov = 2 * Math.atan(Math.tan(config.hfov/360*Math.PI) * renderer.canvas.height / renderer.canvas.width) * 180 / Math.PI; @@ -557,7 +557,7 @@ function onDocumentTouchMove(event) { } var yaw = (onPointerDownPointerX - clientX) * 0.1 + onPointerDownYaw; - yawSpeed = (yaw - config.yaw) * 0.2; + yawSpeed = (yaw - config.yaw) % 360 * 0.2; config.yaw = yaw; var pitch = (clientY - onPointerDownPointerY) * 0.1 + onPointerDownPitch;