Skip to content

Commit

Permalink
fix(zoom): fix zoom out on double tap on sensitive touch screens
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Mar 31, 2023
1 parent 8f4f07b commit 7f5c626
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/modules/zoom/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return;
const zoom = swiper.zoom;
if (!gesture.imageEl) return;
swiper.allowClick = false;
if (!image.isTouched || !gesture.slideEl) return;

if (!image.isMoved) {
Expand All @@ -252,6 +251,13 @@ export default function Zoom({ swiper, extendParams, on, emit }) {

image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX;
image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY;
const touchesDiff = Math.max(
Math.abs(image.touchesCurrent.x - image.touchesStart.x),
Math.abs(image.touchesCurrent.y - image.touchesStart.y),
);
if (touchesDiff > 5) {
swiper.allowClick = false;
}

if (!image.isMoved && !isScaling) {
if (
Expand Down

0 comments on commit 7f5c626

Please sign in to comment.