mirror of
https://github.com/iv-org/videojs-vtt-thumbnails.git
synced 2024-09-28 22:05:40 +00:00
added fix Comparing changes
This commit is contained in:
parent
ceed945872
commit
d2ef719bfb
@ -198,7 +198,7 @@ class vttThumbnailsPlugin {
|
|||||||
|
|
||||||
onBarMousemove (event) {
|
onBarMousemove (event) {
|
||||||
this.updateThumbnailStyle(
|
this.updateThumbnailStyle(
|
||||||
this.getXCoord(this.progressBar, event.clientX),
|
videojs.dom.getPointerPosition(this.progressBar, event).x,
|
||||||
this.progressBar.offsetWidth
|
this.progressBar.offsetWidth
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -220,16 +220,16 @@ class vttThumbnailsPlugin {
|
|||||||
this.thumbnailHolder.style.opacity = '0'
|
this.thumbnailHolder.style.opacity = '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
updateThumbnailStyle (x, width) {
|
updateThumbnailStyle (percent, width) {
|
||||||
const duration = this.player.duration()
|
const duration = this.player.duration()
|
||||||
const time = ((1 - ((width - x) / width))) * duration
|
const time = percent * duration
|
||||||
const currentStyle = this.getStyleForTime(time)
|
const currentStyle = this.getStyleForTime(time)
|
||||||
|
|
||||||
if (!currentStyle) {
|
if (!currentStyle) {
|
||||||
return this.hideThumbnailHolder()
|
return this.hideThumbnailHolder()
|
||||||
}
|
}
|
||||||
|
|
||||||
const xPos = ((1 - ((width - x) / width))) * width
|
const xPos = percent * width
|
||||||
|
|
||||||
this.thumbnailHolder.style.transform = 'translateX(' + xPos + 'px)'
|
this.thumbnailHolder.style.transform = 'translateX(' + xPos + 'px)'
|
||||||
this.thumbnailHolder.style.marginLeft = '-' + (parseInt(currentStyle.width) / 2) + 'px'
|
this.thumbnailHolder.style.marginLeft = '-' + (parseInt(currentStyle.width) / 2) + 'px'
|
||||||
|
Loading…
Reference in New Issue
Block a user