From b20c95f7962adaab7a70c2e4a6963d8a4fc1e6c0 Mon Sep 17 00:00:00 2001 From: Stefan Repac Date: Mon, 31 May 2021 17:21:33 +0200 Subject: [PATCH] Disable swipe if user pinch-to-zoom --- src/js/lightcase.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/lightcase.js b/src/js/lightcase.js index aedb679..6f56f6b 100644 --- a/src/js/lightcase.js +++ b/src/js/lightcase.js @@ -1093,18 +1093,28 @@ // Enable swiping if activated if (_self.settings.swipe === true) { - if ($.isPlainObject($.event.special.swipeleft)) { + // Enable swipe on init + var viewportScale = 1; + if ($.isPlainObject($.event.special.swipeleft) && viewportScale <= 1) { _self.objects.case.on('swipeleft', function (event) { event.preventDefault(); + // Check for pinch-to-zoom Gesture + viewportScale = screen.width / window.innerWidth; + if(viewportScale > 1) return; + _self.objects.next.click(); if (_self.isSlideshowEnabled()) { _self._stopTimeout(); } }); } - if ($.isPlainObject($.event.special.swiperight)) { + if ($.isPlainObject($.event.special.swiperight) && viewportScale <= 1) { _self.objects.case.on('swiperight', function (event) { event.preventDefault(); + // Check for pinch-to-zoom Gesture + viewportScale = screen.width / window.innerWidth; + if(viewportScale > 1) return; + _self.objects.prev.click(); if (_self.isSlideshowEnabled()) { _self._stopTimeout();