react-magic-card 0.1.9 → 0.1.10

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.
@@ -46,7 +46,7 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
46
46
  // turn left
47
47
  const shiftLeft = (0, react_1.useCallback)(() => {
48
48
  setSelect(select == 0 ? images.length - 1 : select - 1);
49
- setHasShift(true);
49
+ setHasShift(false);
50
50
  setHasDelayed(false);
51
51
  if (dynamic)
52
52
  return setCount(count + centralAngle);
@@ -54,7 +54,7 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
54
54
  // turn right
55
55
  const shiftRight = (0, react_1.useCallback)(() => {
56
56
  setSelect(select == images.length - 1 ? 0 : select + 1);
57
- setHasShift(false);
57
+ setHasShift(true);
58
58
  setHasDelayed(false);
59
59
  if (dynamic)
60
60
  return setCount(count - centralAngle);
@@ -77,12 +77,11 @@ const MagicCircle = ({ images, height, width, radius, controller, start, dynamic
77
77
  const handleTouchMove = (0, react_1.useCallback)((event) => {
78
78
  const touch = event.touches[0];
79
79
  const delta = hasPick ? touch.clientX : touch.clientY;
80
- if (delta < (touchStartY || touchStartX))
80
+ if (hasPick ? delta < touchStartX : delta < touchStartY)
81
81
  clockwise ? shiftLeft() : shiftRight();
82
- if (delta > (touchStartY || touchStartX))
82
+ if (hasPick ? delta > touchStartX : delta > touchStartY)
83
83
  clockwise ? shiftRight() : shiftLeft();
84
- setTouchStartX(delta);
85
- setTouchStartY(delta);
84
+ hasPick ? setTouchStartX(delta) : setTouchStartY(delta);
86
85
  }, [clockwise, hasPick, shiftLeft, shiftRight, touchStartX, touchStartY]);
87
86
  // Main functional, exit function if ref and hasDelayed does not exist.
88
87
  (0, react_1.useEffect)(() => {
@@ -70,17 +70,12 @@ 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 = hasPick
74
- ? touch.clientX
75
- : !vertical
76
- ? touch.clientX
77
- : touch.clientY;
78
- if (delta < (touchStartX || touchStartY))
73
+ const delta = hasPick ? touch.clientX : touch.clientY;
74
+ if (hasPick ? delta < touchStartX : delta < touchStartY)
79
75
  shiftLeft();
80
- if (delta > (touchStartX || touchStartY))
76
+ if (hasPick ? delta > touchStartX : delta > touchStartY)
81
77
  shiftRight();
82
- setTouchStartX(delta);
83
- setTouchStartY(delta);
78
+ hasPick ? setTouchStartX(delta) : setTouchStartY(delta);
84
79
  }, [hasPick, shiftLeft, shiftRight, touchStartX, touchStartY, vertical]);
85
80
  // Main functional, exit function if ref and hasDelayed does not exist.
86
81
  (0, react_1.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-magic-card",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "image gallery component with framer motion",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",