mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
bugfix
This commit is contained in:
1 parent
e528465a6e
commit
70fd29429e
3 files changed
+8
-12
No files matched your search
@@ -2,11 +2,7 @@ import { clamp, secondToTime, isMobile, includeFromEvent } from '../utils';
|
||||
|
||||
export default function gestureInit(art, events) {
|
||||
if (isMobile && !art.option.isLive) {
|
||||
const {
|
||||
notice,
|
||||
plugins,
|
||||
template: { $video, $bottom, $controls },
|
||||
} = art;
|
||||
const { $video, $bottom, $controls } = art.template;
|
||||
|
||||
let isDroging = false;
|
||||
let startX = 0;
|
||||
@@ -25,7 +21,7 @@ export default function gestureInit(art, events) {
|
||||
|
||||
const onTouchMove = (event) => {
|
||||
if (event.touches.length === 1 && isDroging && art.duration) {
|
||||
const autoOrientation = plugins.autoOrientation && plugins.autoOrientation.state;
|
||||
const autoOrientation = art.plugins.autoOrientation && art.plugins.autoOrientation.state;
|
||||
const { clientX, clientY } = event.touches[0];
|
||||
const ratioX = clamp((clientX - startX) / art.width, -1, 1);
|
||||
const ratioY = clamp((clientY - startY) / art.height, -1, 1);
|
||||
@@ -33,7 +29,7 @@ export default function gestureInit(art, events) {
|
||||
const currentTime = clamp(startTime + (art.duration * ratio) / 2, 0, art.duration);
|
||||
art.seek = currentTime;
|
||||
art.emit('setBar', 'played', clamp(currentTime / art.duration, 0, 1));
|
||||
notice.show = `${secondToTime(currentTime)} / ${secondToTime(art.duration)}`;
|
||||
art.notice.show = `${secondToTime(currentTime)} / ${secondToTime(art.duration)}`;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user