mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
add Artplayer.TOUCH_MOVE_RATIO
This commit is contained in:
1 parent
62988f04e0
commit
41c39284c5
7 files changed
+13
-4
No files matched your search
@@ -26,7 +26,11 @@ export default function gestureInit(art, events) {
|
||||
const ratioX = clamp((clientX - startX) / art.width, -1, 1);
|
||||
const ratioY = clamp((clientY - startY) / art.height, -1, 1);
|
||||
const ratio = autoOrientation ? ratioY : ratioX;
|
||||
const currentTime = clamp(startTime + (art.duration * ratio) / 2, 0, art.duration);
|
||||
const currentTime = clamp(
|
||||
startTime + art.duration * ratio * art.constructor.TOUCH_MOVE_RATIO,
|
||||
0,
|
||||
art.duration,
|
||||
);
|
||||
art.seek = currentTime;
|
||||
art.emit('setBar', 'played', clamp(currentTime / art.duration, 0, 1));
|
||||
art.notice.show = `${secondToTime(currentTime)} / ${secondToTime(art.duration)}`;
|
||||
|
||||
@@ -226,6 +226,7 @@ Artplayer.MOBILE_AUTO_ORIENTATION_TIME = 200;
|
||||
Artplayer.INFO_LOOP_TIME = 1000;
|
||||
Artplayer.FAST_FORWARD_VALUE = 3;
|
||||
Artplayer.FAST_FORWARD_TIME = 1000;
|
||||
Artplayer.TOUCH_MOVE_RATIO = 0.5;
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
if (!document.getElementById('artplayer-style')) {
|
||||
|
||||
+1
@@ -705,6 +705,7 @@ declare class Artplayer extends Player {
|
||||
static INFO_LOOP_TIME: number;
|
||||
static FAST_FORWARD_VALUE: number;
|
||||
static FAST_FORWARD_TIME: number;
|
||||
static TOUCH_MOVE_RATIO: number;
|
||||
|
||||
on(name: Events, fn: Function, ctx?: object): void;
|
||||
once(name: Events, fn: Function, ctx?: object): void;
|
||||
|
||||
Reference in new issue
Block a user