From ab9601aa3427d6e219728037fc2f17bd592310d3 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sat, 23 Jul 2022 19:40:50 -0400 Subject: [PATCH] Display orientation control button on iPads (fixes #1093). As iPads use the same user agent as Mac, we need to check if touch input is supported instead. --- src/js/pannellum.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 1b49974..a5ab5a7 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -276,7 +276,8 @@ controls.orientation.addEventListener('pointerdown', function(e) {e.stopPropagat controls.orientation.className = 'pnlm-orientation-button pnlm-orientation-button-inactive pnlm-sprite pnlm-controls pnlm-control'; var orientationSupport = false; if (window.DeviceOrientationEvent && location.protocol == 'https:' && - navigator.userAgent.toLowerCase().indexOf('mobi') >= 0) { + (navigator.userAgent.toLowerCase().indexOf('mobi') >= 0 || + (/* iPad */ navigator.userAgent.indexOf("Mac") >= 0 && navigator.maxTouchPoints && navigator.maxTouchPoints > 0))) { // This user agent check is here because there's no way to check if a // device has an inertia measurement unit. We used to be able to check if a // DeviceOrientationEvent had non-null values, but with iOS 13 requiring a