Skip to content

Commit c55480e

Browse files
MAGETWO-93818: Magnifier function does not disappear after mouse-off the image from the bottom
1 parent a7dcd7b commit c55480e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/web/magnifier/magnifier.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,15 @@
554554
thumbObj.src = thumb.src;
555555
}
556556

557+
/**
558+
* Hide magnifier when mouse exceeds image bounds.
559+
*/
560+
function onMouseLeave() {
561+
onThumbLeave();
562+
isOverThumb = false;
563+
$magnifierPreview.addClass(MagnifyCls.magnifyHidden);
564+
}
565+
557566
function onMousemove(e) {
558567
pos.x = e.clientX;
559568
pos.y = e.clientY;
@@ -564,15 +573,9 @@
564573
isOverThumb = inBounds;
565574
}
566575

567-
if (inBounds && isOverThumb) {
568-
if(gMode === 'outside'){
569-
$magnifierPreview.removeClass(MagnifyCls.magnifyHidden);
570-
}
576+
if (inBounds && isOverThumb && gMode === 'outside') {
577+
$magnifierPreview.removeClass(MagnifyCls.magnifyHidden);
571578
move();
572-
} else {
573-
onThumbLeave();
574-
isOverThumb = false;
575-
$magnifierPreview.addClass(MagnifyCls.magnifyHidden);
576579
}
577580
}
578581

@@ -589,6 +592,8 @@
589592
});
590593

591594
$box.on('mousemove', onMousemove);
595+
$box.on('mouseleave', onMouseLeave);
596+
592597
_init($box, customUserOptions);
593598
}
594599
}(jQuery));

0 commit comments

Comments
 (0)