rocket-cursor-component 1.0.7 → 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
@@ -44,6 +44,7 @@ export default App;
44
44
  - **Rotation**: The rocket rotates in the direction of the cursor movement.
45
45
  - **Flame Effect**: The rocket displays a flame animation when the cursor is moving.
46
46
  - **Customizable**: Easily adjust the size, rotation threshold, and visibility of the rocket.
47
+ - **Element-Specific Visibility**: Automatically hides the rocket cursor over elements with the class `no-rocket-cursor`.
47
48
 
48
49
  ## Demo
49
50
 
@@ -53,6 +54,10 @@ Here’s a demo of the Rocket Cursor in action:
53
54
 
54
55
  ## Changelog
55
56
 
57
+ ### 1.0.9
58
+
59
+ - Added support to hide the Rocket Cursor on elements with the class `no-rocket-cursor`.
60
+
56
61
  ### 1.0.2
57
62
 
58
63
  - Added demo GIF in the README file.
@@ -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.7",
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