aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plugins/previewThumbnails.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2019-06-21 00:12:10 +1000
committerGitHub <noreply@github.com>2019-06-21 00:12:10 +1000
commit95092edc93d713b927c637cefc27945f8537d565 (patch)
tree27464f2f98a519f78ff3cc4a2c49ebdd5c6dab2c /src/js/plugins/previewThumbnails.js
parent1e761e237aceb49b29291946a39eef958d6da966 (diff)
parentc4b3e0672e86f2a2786f315bf8f54250cd1f7f78 (diff)
downloadplyr-95092edc93d713b927c637cefc27945f8537d565.tar.lz
plyr-95092edc93d713b927c637cefc27945f8537d565.tar.xz
plyr-95092edc93d713b927c637cefc27945f8537d565.zip
Merge pull request #1472 from sampotts/develop
v3.5.5
Diffstat (limited to 'src/js/plugins/previewThumbnails.js')
-rw-r--r--src/js/plugins/previewThumbnails.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/js/plugins/previewThumbnails.js b/src/js/plugins/previewThumbnails.js
index f03abe69..67367b95 100644
--- a/src/js/plugins/previewThumbnails.js
+++ b/src/js/plugins/previewThumbnails.js
@@ -2,6 +2,7 @@ import { createElement } from '../utils/elements';
import { once } from '../utils/events';
import fetch from '../utils/fetch';
import is from '../utils/is';
+import { extend } from '../utils/objects';
import { formatTime } from '../utils/time';
// Arg: vttDataString example: "WEBVTT\n\n1\n00:00:05.000 --> 00:00:10.000\n1080p-00001.jpg"
@@ -100,6 +101,10 @@ class PreviewThumbnails {
}
this.getThumbnails().then(() => {
+ if (!this.enabled) {
+ return;
+ }
+
// Render DOM elements
this.render();
@@ -425,7 +430,9 @@ class PreviewThumbnails {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
+ // eslint-disable-next-line no-param-reassign
image.dataset.deleting = true;
+
// This has to be set before the timeout - to prevent issues switching between hover and scrub
const { currentImageContainer } = this;
@@ -632,9 +639,13 @@ class PreviewThumbnails {
// Find difference between height and preview container height
const multiplier = this.thumbContainerHeight / frame.h;
+ // eslint-disable-next-line no-param-reassign
previewImage.style.height = `${Math.floor(previewImage.naturalHeight * multiplier)}px`;
+ // eslint-disable-next-line no-param-reassign
previewImage.style.width = `${Math.floor(previewImage.naturalWidth * multiplier)}px`;
+ // eslint-disable-next-line no-param-reassign
previewImage.style.left = `-${frame.x * multiplier}px`;
+ // eslint-disable-next-line no-param-reassign
previewImage.style.top = `-${frame.y * multiplier}px`;
}
}