Skip to content

Commit 2b5dea6

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

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lib/web/magnifier/magnify.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ define([
3131
endX,
3232
transitionEnabled,
3333
transitionActive = false,
34-
tapFlag,
34+
tapFlag = 0,
3535
allowZoomOut = false,
3636
allowZoomIn = true;
3737

38-
tapFlag = new Date().getTime();
3938
transitionEnabled = document.documentElement.style.transition !== undefined ||
4039
document.documentElement.style.WebkitTransition !== undefined ||
4140
document.documentElement.style.MozTransition !== undefined ||
@@ -521,6 +520,7 @@ define([
521520
* Method which makes draggable picture. Also work on touch devices.
522521
*/
523522
function magnifierFullscreen(fotorama) {
523+
tapFlag = new Date().getTime();
524524
var isDragActive = false,
525525
startX,
526526
startY,
@@ -636,21 +636,21 @@ define([
636636
}
637637

638638
function detectDoubleTap(e) {
639-
var now = new Date().getTime(),
639+
let now = new Date().getTime(),
640640
timesince = now - tapFlag;
641641

642-
if (timesince < 2000 && timesince > 400) {
642+
if (timesince > 10 && (isTouchEnabled && timesince < 400) || (!isTouchEnabled && timesince < 2000)) {
643643
transitionActive = false;
644644
dblClickHandler(e);
645+
tapFlag = now;
645646
}
647+
646648
tapFlag = now;
647649
}
648650

649651
$image.off('dblclick');
650652
$image.on('dblclick', detectDoubleTap);
651-
$image.on('click', function (e) {
652-
detectDoubleTap(e);
653-
});
653+
$image.on('touchend', detectDoubleTap);
654654

655655
if (gallery.fullScreen) {
656656
toggleZoomButtons($image, isTouchEnabled, checkForVideo(fotorama.activeFrame.$stageFrame));
@@ -820,12 +820,6 @@ define([
820820
}
821821
});
822822

823-
$image.on('touchend', function (e) {
824-
if (isTouchEnabled && gallery.fullScreen) {
825-
detectDoubleTap(e);
826-
}
827-
});
828-
829823
$(window).off('resize', resizeHandler);
830824
$(window).on('resize', {
831825
$image: $image,

0 commit comments

Comments
 (0)