Skip to content

Commit 3d34a3c

Browse files
committed
MAGETWO-94989: [2.3] Magnifier function does not disappear after mouse-off the image from the bottom
1 parent ab5c07d commit 3d34a3c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/web/magnifier/magnifier.js

Lines changed: 13 additions & 9 deletions
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,20 +573,13 @@
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

579582
function onScroll() {
580-
581583
if (curThumb !== null) {
582584
setThumbData(curThumb, magnifierOptions);
583585
}
@@ -589,6 +591,8 @@
589591
});
590592

591593
$box.on('mousemove', onMousemove);
594+
$box.on('mouseleave', onMouseLeave);
595+
592596
_init($box, customUserOptions);
593597
}
594598
}(jQuery));

0 commit comments

Comments
 (0)