mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-13 07:46:17 -08:00
fix: adjust percentage calculation for current time in setCurrentTime function
This commit is contained in:
1 parent
6aa6f9ad53
commit
7e0b84ba7c
2 files changed
+2
-2
No files matched your search
@@ -1201,7 +1201,7 @@ ${line.text}`;
|
||||
}
|
||||
function setCurrentTime(art, event) {
|
||||
if (art.isRotate) {
|
||||
const percentage = event.touches[0].clientY / art.height;
|
||||
const percentage = (event.touches[0].clientY - art.top) / art.height;
|
||||
const second = percentage * art.duration;
|
||||
art.emit("setBar", "played", percentage, event);
|
||||
art.seek = second;
|
||||
|
||||
@@ -13,7 +13,7 @@ export function getPosFromEvent(art, event) {
|
||||
|
||||
export function setCurrentTime(art, event) {
|
||||
if (art.isRotate) {
|
||||
const percentage = event.touches[0].clientY / art.height
|
||||
const percentage = (event.touches[0].clientY - art.top) / art.height
|
||||
const second = percentage * art.duration
|
||||
art.emit('setBar', 'played', percentage, event)
|
||||
art.seek = second
|
||||
|
||||
Reference in new issue
Block a user