Skip to content

Commit d551105

Browse files
committed
ACP2E-3198: [cloud] Two-finger zoom and move issue on the real mobile device
1 parent ebea5b0 commit d551105

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

lib/web/magnifier/magnify.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ define([
370370
return false;
371371
}
372372

373-
function zoomOut(e, xStep, yStep) {
373+
function zoomOut(e, xStep, yStep, fitIntoParentFlag = false) {
374374
var $image,
375375
widthResult,
376376
heightResult,
@@ -381,8 +381,7 @@ define([
381381
imageHeight,
382382
zoomWidthStep,
383383
zoomHeightStep,
384-
ratio,
385-
fitIntoParent;
384+
ratio;
386385

387386
if (allowZoomOut && (!transitionEnabled || !transitionActive) && (isTouchEnabled ||
388387
!$(zoomOutButtonSelector).hasClass(zoomOutDisabled))) {
@@ -408,7 +407,7 @@ define([
408407
zoomWidthStep = xStep || imageWidth - widthResult;
409408
}
410409

411-
fitIntoParent = function () {
410+
let fitIntoParent = function () {
412411
if (ratio > parentWidth / parentHeight) {
413412
widthResult = parentWidth;
414413
zoomWidthStep = imageWidth - widthResult;
@@ -445,9 +444,11 @@ define([
445444
};
446445
checkFullscreenImagePosition($image, dimensions, zoomWidthStep, zoomHeightStep);
447446
} else {
448-
allowZoomOut = dragFlag = false;
449447
toggleStandartNavigation();
450-
fitIntoParent();
448+
if (fitIntoParentFlag) {
449+
allowZoomOut = dragFlag = false;
450+
fitIntoParent();
451+
}
451452
}
452453
} else if (heightResult > parentHeight) {
453454
dimensions = {
@@ -462,9 +463,11 @@ define([
462463
};
463464
checkFullscreenImagePosition($image, dimensions, zoomWidthStep, zoomHeightStep);
464465
} else {
465-
allowZoomOut = dragFlag = false;
466466
toggleStandartNavigation();
467-
fitIntoParent();
467+
if (fitIntoParentFlag) {
468+
allowZoomOut = dragFlag = false;
469+
fitIntoParent();
470+
}
468471
}
469472
}
470473

@@ -627,11 +630,11 @@ define([
627630
);
628631

629632
if (prevDiff > 0) {
630-
if (curDiff > prevDiff && allowZoomIn) {
631-
zoomIn(ev, 1.5 * curDiff, 1.5 * curDiff);
633+
if (curDiff - prevDiff > 0.2 && allowZoomIn) {
634+
zoomIn(ev, curDiff, curDiff);
632635
}
633-
if (curDiff < prevDiff && allowZoomOut) {
634-
zoomOut(ev, 1.5 * curDiff, 1.5 * curDiff);
636+
if (curDiff - prevDiff < -0.2 && allowZoomOut) {
637+
zoomOut(ev, curDiff, curDiff);
635638
}
636639
}
637640

@@ -675,7 +678,12 @@ define([
675678
if (allowZoomIn) {
676679
zoomIn(e, imgOriginalSize.rw - $image.width(), imgOriginalSize.rh - $image.height());
677680
} else if (allowZoomOut) {
678-
zoomOut(e, imgOriginalSize.rw * proportions, imgOriginalSize.rh - $imageContainer.height());
681+
zoomOut(
682+
e,
683+
imgOriginalSize.rw * proportions,
684+
imgOriginalSize.rh - $imageContainer.height(),
685+
true
686+
);
679687
}
680688
}
681689

0 commit comments

Comments
 (0)