Update progress.js

This commit is contained in:
Harvey Zack authored and GitHub committed 2018-10-19 21:56:32 +08:00
1 parent 62a6ba96ac
commit 201f7b7697
1 file changed
+1 -1
+1 -1
View File
@@ -131,7 +131,7 @@ export default class Progress {
getPos(event) {
const { $video } = this.art.refs;
const { left } = this.option.ref.getBoundingClientRect();
const width = Math.max(0, event.x - left);
const width = clamp(event.x - left, 0, this.option.ref.clientWidth);
const second = width / this.option.ref.clientWidth * $video.duration;
const time = secondToTime(second);
const percentage = clamp(width / this.option.ref.clientWidth, 0, 1);