mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
refactor(core): CORE-19 type capture and preserve progress lifetimes
This commit is contained in:
1 parent
98a1800032
commit
ccf77c4ed2
49 files changed
+31570
-681
No files matched your search
@@ -23,15 +23,21 @@ export function getPosFromEvent(art: ProgressPositionHost, event: ProgressEvent)
|
||||
}
|
||||
|
||||
export function setCurrentTime(art: ProgressPositionHost, event: ProgressEvent, active: () => boolean = () => true) {
|
||||
if (!active())
|
||||
return
|
||||
if (art.isRotate) {
|
||||
const percentage = ((event as TouchEvent).touches[0]!.clientY - art.top) / art.height
|
||||
const second = percentage * art.duration
|
||||
if (!active())
|
||||
return
|
||||
art.emit('setBar', 'played', percentage, event)
|
||||
if (active())
|
||||
art.seek = second
|
||||
}
|
||||
else {
|
||||
const { second, percentage } = getPosFromEvent(art, event)
|
||||
if (!active())
|
||||
return
|
||||
art.emit('setBar', 'played', percentage, event)
|
||||
if (active())
|
||||
art.seek = second
|
||||
|
||||
Reference in new issue
Block a user