From fde3fbd5520fa58f3ce63ef83b61bdab46fffb41 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Wed, 21 Aug 2024 17:10:25 -0400 Subject: [PATCH] Zero out roll when `stopOrientation` is called (fixes #1230). Previously, all the internal calls to `stopOrientation` were followed by setting the roll to zero, but this was not done when the function was called via the API. As this roll parameter is only used for device orientation control, there's no API method to change it, so it was previously not possible to zero out the roll when device orientation control was stopped using the API. --- src/js/pannellum.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index cb2489d..0cc5423 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -803,7 +803,6 @@ function onDocumentMouseDown(event) { stopAnimation(); stopOrientation(); - config.roll = 0; speed.hfov = 0; @@ -932,7 +931,6 @@ function onDocumentTouchStart(event) { stopAnimation(); stopOrientation(); - config.roll = 0; speed.hfov = 0; @@ -1181,7 +1179,6 @@ function onDocumentKeyPress(event) { latestInteraction = Date.now(); stopOrientation(); - config.roll = 0; // Record key pressed var keynumber = event.which || event.keycode; @@ -2569,6 +2566,7 @@ function stopOrientation() { window.removeEventListener('deviceorientation', orientationListener); controls.orientation.classList.remove('pnlm-orientation-button-active'); orientation = false; + config.roll = 0; } /**