update gestureInit

This commit is contained in:
Harvey committed 2022-04-27 18:33:33 +08:00
1 parent f4ade95551
commit e4f815e24f
3 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@ 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, 0, art.duration);
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)}`;