Skip to content

Commit 3cc4ef3

Browse files
committed
ACP2E-3029: [Cloud] Mobile Issue Only not able to pinch on the PDP image
1 parent d949a83 commit 3cc4ef3

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

lib/web/magnifier/magnify.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ define([
1818
zoomInButtonSelector = '[data-gallery-role="fotorama__zoom-in"]',
1919
zoomOutButtonSelector = '[data-gallery-role="fotorama__zoom-out"]',
2020
fullscreenImageSelector = '[data-gallery-role="stage-shaft"] [data-active="true"] .fotorama__img--full',
21+
2122
imageDraggableClass = 'fotorama__img--draggable',
2223
imageZoommable = 'fotorama__img--zoommable',
2324
zoomInLoaded = 'zoom-in-loaded',
@@ -31,10 +32,11 @@ define([
3132
endX,
3233
transitionEnabled,
3334
transitionActive = false,
34-
tapFlag = 0,
35+
tapFlag,
3536
allowZoomOut = false,
3637
allowZoomIn = true;
3738

39+
tapFlag = new Date().getTime();
3840
transitionEnabled = document.documentElement.style.transition !== undefined ||
3941
document.documentElement.style.WebkitTransition !== undefined ||
4042
document.documentElement.style.MozTransition !== undefined ||
@@ -638,24 +640,18 @@ define([
638640
var now = new Date().getTime(),
639641
timesince = now - tapFlag;
640642

641-
if (timesince < 400 && timesince > 0) {
643+
if (timesince < 2000 && timesince > 400) {
642644
transitionActive = false;
643-
tapFlag = 0;
644645
dblClickHandler(e);
645-
} else {
646-
tapFlag = new Date().getTime();
647646
}
647+
tapFlag = now;
648648
}
649649

650-
$image.off('tap');
651-
$image.on('tap', function (e) {
652-
if (e.originalEvent.originalEvent.touches.length === 0) {
653-
detectDoubleTap(e);
654-
}
655-
});
656-
657650
$image.off('dblclick');
658651
$image.on('dblclick', detectDoubleTap);
652+
$image.on('click', function (e) {
653+
detectDoubleTap(e);
654+
});
659655

660656
if (gallery.fullScreen) {
661657
toggleZoomButtons($image, isTouchEnabled, checkForVideo(fotorama.activeFrame.$stageFrame));
@@ -822,10 +818,12 @@ define([
822818

823819
isDragActive = false;
824820
$image.removeClass(imageDraggableClass);
821+
}
822+
});
825823

826-
if (isTouchEnabled) {
827-
detectDoubleTap(e);
828-
}
824+
$image.on('touchend', function (e) {
825+
if (isTouchEnabled && gallery.fullScreen) {
826+
detectDoubleTap(e);
829827
}
830828
});
831829

0 commit comments

Comments
 (0)