From 3fa9cf2c94081f5d7b71d6339b2c2348de42886c Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sun, 23 Oct 2022 22:40:08 -0600 Subject: [PATCH] Clamp x-axis rotation --- panorama-viewer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panorama-viewer.js b/panorama-viewer.js index e29f506..458abcc 100644 --- a/panorama-viewer.js +++ b/panorama-viewer.js @@ -159,6 +159,11 @@ case "mousemove": θy += event.movementX * 0.005; θx += event.movementY * 0.005; + if (θx < -Math.PI / 2) { + θx = -Math.PI / 2; + } else if (θx > Math.PI / 2) { + θx = Math.PI / 2; + } break } return PanState.panning;