From d2ef719bfba86fe342af27f78c0163e2954e96a8 Mon Sep 17 00:00:00 2001 From: "agomez@bitcentral.net" Date: Wed, 31 Jul 2019 13:28:58 -0500 Subject: [PATCH] added fix Comparing changes --- src/plugin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 64a9cd4..41745e7 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -198,7 +198,7 @@ class vttThumbnailsPlugin { onBarMousemove (event) { this.updateThumbnailStyle( - this.getXCoord(this.progressBar, event.clientX), + videojs.dom.getPointerPosition(this.progressBar, event).x, this.progressBar.offsetWidth ) } @@ -220,16 +220,16 @@ class vttThumbnailsPlugin { this.thumbnailHolder.style.opacity = '0' } - updateThumbnailStyle (x, width) { + updateThumbnailStyle (percent, width) { const duration = this.player.duration() - const time = ((1 - ((width - x) / width))) * duration + const time = percent * duration const currentStyle = this.getStyleForTime(time) if (!currentStyle) { return this.hideThumbnailHolder() } - const xPos = ((1 - ((width - x) / width))) * width + const xPos = percent * width this.thumbnailHolder.style.transform = 'translateX(' + xPos + 'px)' this.thumbnailHolder.style.marginLeft = '-' + (parseInt(currentStyle.width) / 2) + 'px'