]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Abandon swipe altogether if more than one touch detected
authorpatrickhlauke <redux@splintered.co.uk>
Mon, 15 Oct 2018 20:54:20 +0000 (21:54 +0100)
committerXhmikosR <xhmikosr@gmail.com>
Sat, 20 Oct 2018 12:32:09 +0000 (15:32 +0300)
js/src/carousel.js

index f0ad83bb0b49915ad633d5ac20d279ca605bf29b..997424bfac9e874a519867080876d893afc8ae8e 100644 (file)
@@ -283,8 +283,8 @@ class Carousel {
 
       if (this._pointerEvent && (originEvent.pointerType === PointerType.TOUCH || originEvent.pointerType === PointerType.PEN)) {
         this.touchStartX = originEvent.clientX
-      } else {
-        this.touchStartX = originEvent.touches[0].pageX
+      } else if (!this._pointerEvent) {
+        this.touchStartX = originEvent.touches[0].clientX
       }
     }
 
@@ -293,11 +293,12 @@ class Carousel {
 
       // ensure swiping with one touch and not pinching
       if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
+        this.touchDeltaX = 0;
         return
       }
 
       if (!this._pointerEvent) {
-        this.touchDeltaX = event.originalEvent.touches[0].pageX - this.touchStartX
+        this.touchDeltaX = event.originalEvent.touches[0].clientX - this.touchStartX
       }
     }