Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MoePlayer/DPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Mar 12, 2019
2 parents 688563f + 47b1615 commit f5c53f0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
3 changes: 2 additions & 1 deletion src/js/thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const utils = {
* getBoundingClientRect 在 Opera 10.5 及以下返回的值缺失 width、height 值
*/
getBoundingClientRectViewLeft (element) {
const scrollTop = document.documentElement.scrollTop;
const scrollTop = window.scrollY || window.pageYOffset || document.body.scrollTop + (document.documentElement && document.documentElement.scrollTop || 0);

if (element.getBoundingClientRect) {
if (typeof this.getBoundingClientRectViewLeft.offset !== 'number') {
Expand Down

0 comments on commit f5c53f0

Please sign in to comment.