diff --git a/lib/web/magnifier/magnify.js b/lib/web/magnifier/magnify.js index 8a3de9a42530f..a31234fb023d6 100644 --- a/lib/web/magnifier/magnify.js +++ b/lib/web/magnifier/magnify.js @@ -26,7 +26,6 @@ define([ zoomOutDisabled = 'fotorama__zoom-out--disabled', videoContainerClass = 'fotorama-video-container', hideMagnifier, - behaveOnHover, dragFlag, endX, allowZoomOut = false, @@ -758,24 +757,22 @@ define([ /** * Hides magnifier on drag and while arrow click. */ - behaveOnHover = function (e, initPos) { + function behaveOnDrag (e, initPos) { var pos = [e.pageX, e.pageY], isArrow = $(e.target).data('gallery-role') === 'arrow', isClick = initPos[0] === pos[0] && initPos[1] === pos[1], isImg = $(e.target).parent().data('active'); - if ((isImg && !isClick) || isArrow) { + if (isArrow || (isImg && !isClick)) { hideMagnifier(); } - }; + } - if (config.magnifierOpts.eventType === 'click') { - config.options.swipe = false; - } else if (config.magnifierOpts.eventType === 'hover') { + if (config.magnifierOpts.enabled) { $(element).on('pointerdown mousedown MSPointerDown', function (e) { var pos = [e.pageX, e.pageY]; $(element).on('mousemove pointermove MSPointerMove', function (ev) { - navigator.msPointerEnabled ? hideMagnifier() : behaveOnHover(ev, pos); + navigator.msPointerEnabled ? hideMagnifier() : behaveOnDrag(ev, pos); }); $(document).on('mouseup pointerup MSPointerUp', function () { $(element).off('mousemove pointermove MSPointerMove');