forked from ConvertGroupsAS/magento2-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatch-Magento_Base-M2.x.x-zoomed-photo-product.patch
44 lines (40 loc) · 1.28 KB
/
Patch-Magento_Base-M2.x.x-zoomed-photo-product.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- lib/web/magnifier/magnifier.js 2018-09-06 14:45:22.000000000 +0300
+++ lib/web/magnifier/magnifier.js 2018-11-28 15:24:40.352148528 +0300
@@ -554,6 +554,16 @@
thumbObj.src = thumb.src;
}
+ /**
+ * Hide magnifier when mouse exceeds image bounds.
+ */
+ function onMouseLeave() {
+ onThumbLeave();
+ isOverThumb = false;
+ $magnifierPreview.addClass(MagnifyCls.magnifyHidden);
+ }
+
+
function onMousemove(e) {
pos.x = e.clientX;
pos.y = e.clientY;
@@ -564,15 +574,9 @@
isOverThumb = inBounds;
}
- if (inBounds && isOverThumb) {
- if(gMode === 'outside'){
+ if (inBounds && isOverThumb && gMode === 'outside') {
$magnifierPreview.removeClass(MagnifyCls.magnifyHidden);
- }
move();
- } else {
- onThumbLeave();
- isOverThumb = false;
- $magnifierPreview.addClass(MagnifyCls.magnifyHidden);
}
}
@@ -589,6 +592,7 @@
});
$box.on('mousemove', onMousemove);
+ $box.on('mouseleave', onMouseLeave);
_init($box, customUserOptions);
}
}(jQuery));