From 9512a466649527ff321da91f1a4670db2691924f Mon Sep 17 00:00:00 2001 From: AnastasiaBuniak Date: Mon, 7 Dec 2015 15:44:54 +0200 Subject: [PATCH 1/2] JS-359: Magnifier on preview swipe/drag --- lib/web/magnifier/magnify.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/web/magnifier/magnify.js b/lib/web/magnifier/magnify.js index 8a3de9a42530f..2c4f66b37498c 100644 --- a/lib/web/magnifier/magnify.js +++ b/lib/web/magnifier/magnify.js @@ -26,7 +26,7 @@ define([ zoomOutDisabled = 'fotorama__zoom-out--disabled', videoContainerClass = 'fotorama-video-container', hideMagnifier, - behaveOnHover, + behaveOnDrag, dragFlag, endX, allowZoomOut = false, @@ -758,24 +758,22 @@ define([ /** * Hides magnifier on drag and while arrow click. */ - behaveOnHover = function (e, initPos) { + behaveOnDrag = function (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'); From d3221327374dfb96f0c2f651ce1bb67bdf6947e5 Mon Sep 17 00:00:00 2001 From: AnastasiaBuniak Date: Mon, 7 Dec 2015 16:32:49 +0200 Subject: [PATCH 2/2] JS-359: Magnifier on preview swipe/drag --- lib/web/magnifier/magnify.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/web/magnifier/magnify.js b/lib/web/magnifier/magnify.js index 2c4f66b37498c..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, - behaveOnDrag, dragFlag, endX, allowZoomOut = false, @@ -758,7 +757,7 @@ define([ /** * Hides magnifier on drag and while arrow click. */ - behaveOnDrag = 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], @@ -767,7 +766,7 @@ define([ if (isArrow || (isImg && !isClick)) { hideMagnifier(); } - }; + } if (config.magnifierOpts.enabled) { $(element).on('pointerdown mousedown MSPointerDown', function (e) {