11import { useEffect , useRef } from 'react' ;
22import { message } from 'antd' ;
3- import { useAtomValue , useSetAtom } from 'jotai' ;
3+ import { useAtomValue } from 'jotai' ;
44import { useTranslation } from 'react-i18next' ;
55
66import { resolutionAtom } from '@/jotai/device.ts' ;
7- import {
8- mouseJigglerModeAtom ,
9- mouseLastMoveTimeAtom ,
10- scrollDirectionAtom ,
11- scrollIntervalAtom
12- } from '@/jotai/mouse.ts' ;
7+ import { scrollDirectionAtom , scrollIntervalAtom } from '@/jotai/mouse.ts' ;
138import { device } from '@/libs/device' ;
149import { Key } from '@/libs/device/mouse.ts' ;
1510
@@ -20,8 +15,6 @@ export const Relative = () => {
2015 const resolution = useAtomValue ( resolutionAtom ) ;
2116 const scrollDirection = useAtomValue ( scrollDirectionAtom ) ;
2217 const scrollInterval = useAtomValue ( scrollIntervalAtom ) ;
23- const mouseJigglerMode = useAtomValue ( mouseJigglerModeAtom ) ;
24- const setMouseLastMoveTime = useSetAtom ( mouseLastMoveTimeAtom ) ;
2518
2619 const isLockedRef = useRef ( false ) ;
2720 const keyRef = useRef < Key > ( new Key ( ) ) ;
@@ -117,11 +110,6 @@ export const Relative = () => {
117110 if ( x === 0 && y === 0 ) return ;
118111
119112 await send ( Math . abs ( x ) < 10 ? x * 2 : x , Math . abs ( y ) < 10 ? y * 2 : y , 0 ) ;
120-
121- // mouse jiggler record last move time
122- if ( mouseJigglerMode === 'enable' ) {
123- setMouseLastMoveTime ( Date . now ( ) ) ;
124- }
125113 }
126114
127115 // mouse scroll
@@ -150,7 +138,7 @@ export const Relative = () => {
150138 canvas . removeEventListener ( 'wheel' , handleWheel ) ;
151139 canvas . removeEventListener ( 'contextmenu' , disableEvent ) ;
152140 } ;
153- } , [ resolution , scrollDirection , scrollInterval , mouseJigglerMode , setMouseLastMoveTime ] ) ;
141+ } , [ resolution , scrollDirection , scrollInterval ] ) ;
154142
155143 async function send ( x : number , y : number , scroll : number ) {
156144 await device . sendMouseRelativeData ( keyRef . current , x , y , scroll ) ;
0 commit comments