rocket-cursor-component 1.0.8 → 1.0.9

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.
package/README.md CHANGED
@@ -54,7 +54,7 @@ Here’s a demo of the Rocket Cursor in action:
54
54
 
55
55
  ## Changelog
56
56
 
57
- ### 1.0.8
57
+ ### 1.0.9
58
58
 
59
59
  - Added support to hide the Rocket Cursor on elements with the class `no-rocket-cursor`.
60
60
 
@@ -8,6 +8,12 @@ const RocketCursor = ({ size = 50, threshold = 10, isVisible = true, }) => {
8
8
  const lastSignificantPosition = useRef({ x: 0, y: 0 });
9
9
  const lastMoveTimestamp = useRef(Date.now());
10
10
  const handleMouseMove = useCallback((e) => {
11
+ const target = e.target;
12
+ // hide rocket cursor if there is class "no-rocket-cursor"
13
+ if (target.closest(".no-rocket-cursor")) {
14
+ setVisible(false);
15
+ return;
16
+ }
11
17
  const currentPosition = { x: e.clientX, y: e.clientY };
12
18
  setPosition(currentPosition);
13
19
  const dx = currentPosition.x - lastSignificantPosition.current.x;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rocket-cursor-component",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "A customizable React component that replaces the cursor with an animated rocket.",
5
5
  "main": "dist/rocket.Cursor.js",
6
6
  "types": "dist/rocket.Cursor.d.ts",
@@ -20,7 +20,14 @@ const RocketCursor: React.FC<RocketCursorProps> = ({
20
20
  const lastMoveTimestamp = useRef(Date.now());
21
21
 
22
22
  const handleMouseMove = useCallback(
23
- (e: { clientX: any; clientY: any }) => {
23
+ (e: MouseEvent) => {
24
+ const target = e.target as HTMLElement;
25
+ // hide rocket cursor if there is class "no-rocket-cursor"
26
+ if (target.closest(".no-rocket-cursor")) {
27
+ setVisible(false);
28
+ return;
29
+ }
30
+
24
31
  const currentPosition = { x: e.clientX, y: e.clientY };
25
32
  setPosition(currentPosition);
26
33