1
+ import type { ApiDto } from '@viewtube/shared' ;
1
2
import { usePopupStore } from '~/store/popup' ;
2
3
import { useSettingsStore } from '~/store/settings' ;
3
- import type { ApiDto } from '@viewtube/shared' ;
4
4
5
5
const UI_TIMEOUT = 3000 ;
6
6
@@ -10,7 +10,8 @@ export const useUIState = (
10
10
videoState : VideoState ,
11
11
video : Ref < ApiDto < 'VTVideoInfoDto' > > ,
12
12
flipPlayerUIRef : Ref < HTMLDivElement | null > ,
13
- captionsState : CaptionsState
13
+ captionsState : CaptionsState ,
14
+ hidden ?: Ref < boolean >
14
15
) => {
15
16
const popupStore = usePopupStore ( ) ;
16
17
const settingsStore = useSettingsStore ( ) ;
@@ -219,6 +220,8 @@ export const useUIState = (
219
220
const doubleTouchPosition = ref ( { x : 0 , y : 0 } ) ;
220
221
221
222
const onPointerDown = ( e : PointerEvent ) => {
223
+ if ( hidden ?. value ) return true ;
224
+
222
225
if ( e . pointerType === 'touch' ) {
223
226
touchEvent . value = true ;
224
227
if ( e . target instanceof HTMLVideoElement ) {
@@ -264,6 +267,8 @@ export const useUIState = (
264
267
265
268
const pointerMoveTimeout = ref < number | NodeJS . Timeout > ( ) ;
266
269
const onPointerMove = ( e : PointerEvent ) => {
270
+ if ( hidden ?. value ) return true ;
271
+
267
272
clearTimeout ( pointerMoveTimeout . value ) ;
268
273
pointerMoveTimeout . value = setTimeout ( ( ) => {
269
274
if ( e . pointerType === 'mouse' && ! touchEvent . value ) {
@@ -273,6 +278,8 @@ export const useUIState = (
273
278
} ;
274
279
275
280
const onPointerLeave = ( e : PointerEvent ) => {
281
+ if ( hidden ?. value ) return true ;
282
+
276
283
clearTimeout ( pointerMoveTimeout . value ) ;
277
284
if ( e . pointerType === 'mouse' && ! touchEvent . value ) {
278
285
hideUI ( ) ;
@@ -286,6 +293,8 @@ export const useUIState = (
286
293
const doubleClickTimeout = ref < number | NodeJS . Timeout > ( ) ;
287
294
288
295
const onPointerUp = ( e : PointerEvent ) => {
296
+ if ( hidden ?. value ) return true ;
297
+
289
298
if ( e . pointerType === 'mouse' && e . target instanceof HTMLVideoElement ) {
290
299
if ( ! doubleClickTimeout . value ) {
291
300
doubleClickTimeout . value = setTimeout ( ( ) => {
0 commit comments