Skip to content

Commit 9512a46

Browse files
JS-359: Magnifier on preview swipe/drag
1 parent e0efae1 commit 9512a46

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/web/magnifier/magnify.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ define([
2626
zoomOutDisabled = 'fotorama__zoom-out--disabled',
2727
videoContainerClass = 'fotorama-video-container',
2828
hideMagnifier,
29-
behaveOnHover,
29+
behaveOnDrag,
3030
dragFlag,
3131
endX,
3232
allowZoomOut = false,
@@ -758,24 +758,22 @@ define([
758758
/**
759759
* Hides magnifier on drag and while arrow click.
760760
*/
761-
behaveOnHover = function (e, initPos) {
761+
behaveOnDrag = function (e, initPos) {
762762
var pos = [e.pageX, e.pageY],
763763
isArrow = $(e.target).data('gallery-role') === 'arrow',
764764
isClick = initPos[0] === pos[0] && initPos[1] === pos[1],
765765
isImg = $(e.target).parent().data('active');
766766

767-
if ((isImg && !isClick) || isArrow) {
767+
if (isArrow || (isImg && !isClick)) {
768768
hideMagnifier();
769769
}
770770
};
771771

772-
if (config.magnifierOpts.eventType === 'click') {
773-
config.options.swipe = false;
774-
} else if (config.magnifierOpts.eventType === 'hover') {
772+
if (config.magnifierOpts.enabled) {
775773
$(element).on('pointerdown mousedown MSPointerDown', function (e) {
776774
var pos = [e.pageX, e.pageY];
777775
$(element).on('mousemove pointermove MSPointerMove', function (ev) {
778-
navigator.msPointerEnabled ? hideMagnifier() : behaveOnHover(ev, pos);
776+
navigator.msPointerEnabled ? hideMagnifier() : behaveOnDrag(ev, pos);
779777
});
780778
$(document).on('mouseup pointerup MSPointerUp', function () {
781779
$(element).off('mousemove pointermove MSPointerMove');

0 commit comments

Comments
 (0)