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

Fix bug that thumbnail appears in the wrong position in fullscreen
This commit is contained in:
DIYgod 2019-03-12 22:23:06 +08:00 committed by GitHub
commit 22987ecde9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -91,7 +91,7 @@ class Controller {
});
this.player.on('loadedmetadata', () => {
this.thumbnails.resize(160, this.player.video.videoHeight / this.player.video.videoWidth * 160);
this.thumbnails.resize(160, this.player.video.videoHeight / this.player.video.videoWidth * 160, this.player.template.barWrap.offsetWidth);
});
}
}

View File

@ -564,6 +564,9 @@ class DPlayer {
if (this.danmaku) {
this.danmaku.resize();
}
if (this.controller.thumbnails) {
this.controller.thumbnails.resize(160, this.video.videoHeight / this.video.videoWidth * 160, this.template.barWrap.offsetWidth);
}
this.events.trigger('resize');
}

View File

@ -6,10 +6,11 @@ class Thumbnails {
this.events = options.events;
}
resize (width, height) {
resize (width, height, barWrapWidth) {
this.container.style.width = `${width}px`;
this.container.style.height = `${height}px`;
this.container.style.top = `${-height + 2}px`;
this.barWidth = barWrapWidth;
}
show () {