mirror of
https://gitea.invidious.io/iv-org/videojs-vtt-thumbnails.git
synced 2024-08-15 00:43:16 +00:00
Further correction of X coord calculation
This commit is contained in:
parent
3d6c6709e2
commit
00251ba9de
2 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "videojs-vtt-thumbnails",
|
"name": "videojs-vtt-thumbnails",
|
||||||
"version": "0.0.9",
|
"version": "0.0.10",
|
||||||
"description": "Display thumnails on progress bar hover, driven by external VTT files.",
|
"description": "Display thumnails on progress bar hover, driven by external VTT files.",
|
||||||
"main": "dist/videojs-vtt-thumbnails.cjs.js",
|
"main": "dist/videojs-vtt-thumbnails.cjs.js",
|
||||||
"module": "dist/videojs-vtt-thumbnails.es.js",
|
"module": "dist/videojs-vtt-thumbnails.es.js",
|
||||||
|
|
|
@ -188,9 +188,15 @@ class vttThumbnailsPlugin {
|
||||||
this.hideThumbnailHolder()
|
this.hideThumbnailHolder()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getXCoord(bar, mouseX) {
|
||||||
|
const rect = bar.getBoundingClientRect();
|
||||||
|
const docEl = document.documentElement;
|
||||||
|
return mouseX - ( rect.left + (window.pageXOffset || docEl.scrollLeft || 0));
|
||||||
|
}
|
||||||
|
|
||||||
onBarMousemove (event) {
|
onBarMousemove (event) {
|
||||||
this.updateThumbnailStyle(
|
this.updateThumbnailStyle(
|
||||||
event.clientX - (this.progressBar.offsetLeft + this.player.el().offsetLeft),
|
this.getXCoord(this.progressBar, event.clientX),
|
||||||
this.progressBar.offsetWidth
|
this.progressBar.offsetWidth
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue