File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/client/composables Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
import type { Ref } from 'vue'
2
2
import { useEventListener } from '@vueuse/core'
3
- import { computed } from 'vue'
3
+ import { computed , watch } from 'vue'
4
4
import { hideCursorIdle } from '../state'
5
5
6
6
const TIMEOUT = 2000
@@ -19,15 +19,24 @@ export function useHideCursorIdle(
19
19
20
20
let timer : ReturnType < typeof setTimeout > | null = null
21
21
22
+ // If disabled, immediately show the cursor
23
+ watch (
24
+ shouldHide ,
25
+ ( value ) => {
26
+ if ( ! value )
27
+ show ( )
28
+ } ,
29
+ )
30
+
22
31
useEventListener (
23
32
document . body ,
24
33
[ 'pointermove' , 'pointerdown' ] ,
25
34
( ) => {
26
35
show ( )
27
- if ( ! shouldHide . value )
28
- return
29
36
if ( timer )
30
37
clearTimeout ( timer )
38
+ if ( ! shouldHide . value )
39
+ return
31
40
timer = setTimeout ( hide , TIMEOUT )
32
41
} ,
33
42
{ passive : true } ,
You can’t perform that action at this time.
0 commit comments