mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
refactor(core): CORE-17 type input events and own interaction lifetimes
This commit is contained in:
1 parent
88aef830df
commit
a842058136
72 files changed
+31156
-1219
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import type { GestureHost } from '../input/gesture-types'
|
||||
import type { PointerRegistry } from '../input/pointer-types'
|
||||
import { gestureController } from '../input/gesture-controller'
|
||||
import { isMobile } from '../utils/compatibility'
|
||||
|
||||
export default function gestureInit(art: GestureHost, events: Pick<PointerRegistry, 'proxy'>): void {
|
||||
if (!isMobile || art.option.isLive)
|
||||
return
|
||||
const { $video, $progress } = art.template
|
||||
const gesture = gestureController(art)
|
||||
const bind = (target: EventTarget) => {
|
||||
events.proxy(target, 'touchstart', event => gesture.start(target, event as TouchEvent))
|
||||
events.proxy(target, 'touchmove', event => gesture.move(event as TouchEvent))
|
||||
events.proxy(target, 'touchcancel', gesture.cancel)
|
||||
}
|
||||
if (art.option.gesture)
|
||||
bind($video)
|
||||
bind($progress)
|
||||
}
|
||||
Reference in new issue
Block a user