From 406d003e5c10449aaa09cb9aadf3c68db9fe5ab1 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 9 Sep 2019 20:12:42 -0400 Subject: [PATCH] Allow touch scrolling when `dragable` is false (fixes #788). --- src/css/pannellum.css | 1 - src/js/pannellum.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/css/pannellum.css b/src/css/pannellum.css index d0b7475..2ff392c 100644 --- a/src/css/pannellum.css +++ b/src/css/pannellum.css @@ -17,7 +17,6 @@ outline: 0; line-height: 1.4; contain: content; - touch-action: none; } .pnlm-container * { diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 8268577..0c7b32a 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -933,6 +933,9 @@ var pointerIDs = [], */ function onDocumentPointerDown(event) { if (event.pointerType == 'touch') { + // Only do something if the panorama is loaded + if (!loaded || !config.draggable) + return; pointerIDs.push(event.pointerId); pointerCoordinates.push({clientX: event.clientX, clientY: event.clientY}); event.targetTouches = pointerCoordinates; @@ -948,6 +951,8 @@ function onDocumentPointerDown(event) { */ function onDocumentPointerMove(event) { if (event.pointerType == 'touch') { + if (!config.draggable) + return; for (var i = 0; i < pointerIDs.length; i++) { if (event.pointerId == pointerIDs[i]) { pointerCoordinates[i].clientX = event.clientX;