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 +1 -1
- package/dist/rocket.Cursor.js +6 -0
- package/package.json +1 -1
- package/src/rocket.Cursor.tsx +8 -1
package/README.md
CHANGED
package/dist/rocket.Cursor.js
CHANGED
|
@@ -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
package/src/rocket.Cursor.tsx
CHANGED
|
@@ -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:
|
|
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
|
|