Merge pull request #360 from A-Circle-Zhang/master

fix #359 and keep thumbnails within the player
This commit is contained in:
DIYgod 2018-08-23 23:37:17 +08:00 committed by GitHub
commit 9f4cfe36ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View File

@ -100,7 +100,6 @@
position: absolute;
left: 0px;
top: -20px;
width: 30px;
border-radius: 4px;
padding: 5px 7px;
background-color: rgba(0, 0, 0, 0.62);

View File

@ -134,7 +134,7 @@ class Controller {
this.thumbnails && this.thumbnails.show();
}
this.thumbnails && this.thumbnails.move(tx);
this.player.template.playedBarTime.style.left = `${(tx - 20)}px`;
this.player.template.playedBarTime.style.left = `${(tx - (time >= 3600 ? 25 : 20))}px`;
this.player.template.playedBarTime.innerText = utils.secondToTime(time);
this.player.template.playedBarTime.classList.remove('hidden');
}

View File

@ -19,7 +19,7 @@ class Thumbnails {
move (position) {
this.container.style.backgroundPosition = `-${(Math.ceil(position / this.barWidth * 100) - 1) * 160}px 0`;
this.container.style.left = `${(position - this.container.offsetWidth / 2)}px`;
this.container.style.left = `${Math.min(Math.max(position - this.container.offsetWidth / 2, -10), this.barWidth - 150)}px`;
}
hide () {
@ -29,4 +29,4 @@ class Thumbnails {
}
}
export default Thumbnails;
export default Thumbnails;