react-magic-card 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,7 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
50
50
  setHasDelayed(false);
51
51
  if (dynamic)
52
52
  return setCount(count - centralAngle);
53
- }, [centralAngle, count, dynamic, images.length, select, hasShift]);
53
+ }, [centralAngle, count, dynamic, images.length, select]);
54
54
  // turn right
55
55
  const shiftRight = (0, react_1.useCallback)(() => {
56
56
  setSelect(select == 0 ? images.length - 1 : select - 1);
@@ -58,7 +58,7 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
58
58
  setHasDelayed(false);
59
59
  if (dynamic)
60
60
  return setCount(count + centralAngle);
61
- }, [centralAngle, count, dynamic, images.length, select, hasShift]);
61
+ }, [centralAngle, count, dynamic, images.length, select]);
62
62
  // Function of the desktop.
63
63
  const handleWheel = (0, react_1.useCallback)((e) => {
64
64
  const delta = e.deltaY;
@@ -68,8 +68,8 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
68
68
  shiftRight();
69
69
  }, [shiftLeft, shiftRight]);
70
70
  // Get a start y and x position in touchStart Y and X.
71
- const handleTouchStart = (event) => {
72
- const touch = event.touches[0];
71
+ const handleTouchStart = (e) => {
72
+ const touch = e.touches[0];
73
73
  setTouchStartY(touch.clientY);
74
74
  setTouchStartX(touch.clientX);
75
75
  };
@@ -83,7 +83,7 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
83
83
  shiftLeft();
84
84
  setTouchStartX(delta);
85
85
  setTouchStartY(delta);
86
- }, [shiftLeft, shiftRight, touchStartY]);
86
+ }, [hasPick, shiftLeft, shiftRight, touchStartX, touchStartY]);
87
87
  // Main functional, exit function if ref and hasDelayed does not exist.
88
88
  (0, react_1.useEffect)(() => {
89
89
  const elm1Div = div1Ref.current;
@@ -204,6 +204,9 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
204
204
  'px'
205
205
  } }));
206
206
  }))),
207
- react_1.default.createElement(PickImage_1.default, { onClick: () => setHasPick(false), hasPick: hasPick, classPick: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.classPick, white: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.white, alpha: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.alpha, blur: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.blur, scale: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.scale, offset: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.offset, hasShift: hasShift, argRef: div2Ref, argKey: select, src: images[select].src, alt: images[select].alt, width: width, height: height, transition: pickTransition, zIndex: images.length + 1 })));
207
+ react_1.default.createElement(PickImage_1.default, { onClick: () => {
208
+ leaveControll();
209
+ setHasPick(false);
210
+ }, hasPick: hasPick, classPick: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.classPick, white: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.white, alpha: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.alpha, blur: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.blur, scale: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.scale, offset: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.offset, hasShift: hasShift, argRef: div2Ref, argKey: select, src: images[select].src, alt: images[select].alt, width: width, height: height, transition: pickTransition, zIndex: images.length + 1 })));
208
211
  };
209
212
  exports.MagicCircle = MagicCircle;
@@ -70,7 +70,11 @@ const MagicStraight = ({ images, height, width, start, controller, wheelDelay, v
70
70
  // Swipe Function of the mobile.
71
71
  const handleTouchMove = (0, react_1.useCallback)((e) => {
72
72
  const touch = e.touches[0];
73
- const delta = !vertical ? touch.clientX : touch.clientY;
73
+ const delta = hasPick
74
+ ? touch.clientX
75
+ : !vertical
76
+ ? touch.clientX
77
+ : touch.clientY;
74
78
  if (delta > (touchStartX || touchStartY))
75
79
  shiftRight();
76
80
  if (delta < (touchStartX || touchStartY))
@@ -204,6 +208,9 @@ const MagicStraight = ({ images, height, width, start, controller, wheelDelay, v
204
208
  margin: vertical ? margin + 'px' + ' 0' : '0 ' + margin + 'px'
205
209
  } }));
206
210
  })),
207
- react_1.default.createElement(PickImage_1.default, { onClick: () => setHasPick(false), hasPick: hasPick, classPick: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.classPick, white: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.white, alpha: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.alpha, blur: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.blur, scale: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.scale, offset: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.offset, hasShift: hasShift, argRef: div2Ref, argKey: select, src: images[select].src, alt: images[select].alt, width: width, height: height, transition: pickTransition, zIndex: images.length + 1 })));
211
+ react_1.default.createElement(PickImage_1.default, { onClick: () => {
212
+ leaveControll();
213
+ setHasPick(false);
214
+ }, hasPick: hasPick, classPick: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.classPick, white: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.white, alpha: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.alpha, blur: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.blur, scale: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.scale, offset: pickProperty === null || pickProperty === void 0 ? void 0 : pickProperty.offset, hasShift: hasShift, argRef: div2Ref, argKey: select, src: images[select].src, alt: images[select].alt, width: width, height: height, transition: pickTransition, zIndex: images.length + 1 })));
208
215
  };
209
216
  exports.MagicStraight = MagicStraight;
@@ -11,7 +11,6 @@ const PickImage = ({ onClick, classPick, hasPick, hasShift, argRef, argKey, src,
11
11
  zIndex: zIndex,
12
12
  opacity: hasPick ? 1 : 0,
13
13
  pointerEvents: hasPick ? 'auto' : 'none',
14
- visibility: hasPick ? 'visible' : 'hidden',
15
14
  backdropFilter: `blur(${blur}px)`,
16
15
  background: white
17
16
  ? `rgba(255, 255, 255, ${alpha})`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-magic-card",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "image gallery component with framer motion",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",