File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
packages/client/composables Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,30 @@ export function useHideCursorIdle(
17
17
document . body . style . cursor = ''
18
18
}
19
19
20
- // If disabled, immediately show the cursor
20
+ let timer : ReturnType < typeof setTimeout > | null = null
21
+
22
+ // If disabled, immediately show the cursor and stop the timer
21
23
watch (
22
24
shouldHide ,
23
25
( value ) => {
24
- if ( ! value )
26
+ if ( ! value ) {
25
27
show ( )
28
+ if ( timer ) {
29
+ clearTimeout ( timer )
30
+ }
31
+ timer = null
32
+ }
26
33
} ,
27
34
)
28
- onScopeDispose ( show )
29
35
30
- let timer : ReturnType < typeof setTimeout > | null = null
36
+ onScopeDispose ( ( ) => {
37
+ show ( )
38
+ if ( timer ) {
39
+ clearTimeout ( timer )
40
+ }
41
+ timer = null
42
+ } )
43
+
31
44
useEventListener (
32
45
document . body ,
33
46
[ 'pointermove' , 'pointerdown' ] ,
You can’t perform that action at this time.
0 commit comments