From 12516e69b90e8ab4c6f42b64560aef92ae539bd0 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Fri, 21 Dec 2018 17:16:14 -0500 Subject: [PATCH] Fix issue with mouse dragging causing jump around yaw limits (fixes #698) --- src/js/pannellum.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index ba6b90b..3d1fb33 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1399,12 +1399,6 @@ function render() { var tmpyaw; if (loaded) { - if (config.yaw > 180) { - config.yaw -= 360; - } else if (config.yaw < -180) { - config.yaw += 360; - } - // Keep a tmp value of yaw for autoRotate comparison later tmpyaw = config.yaw; @@ -1439,6 +1433,12 @@ function render() { config.yaw = Math.max(minYaw, Math.min(maxYaw, config.yaw)); } + if (config.yaw > 180) { + config.yaw -= 360; + } else if (config.yaw < -180) { + config.yaw += 360; + } + // Check if we autoRotate in a limited by min and max yaw // If so reverse direction if (config.autoRotate !== false && tmpyaw != config.yaw &&