diff options
author | Sam Potts <sam@potts.es> | 2020-02-10 18:35:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-10 18:35:42 +0000 |
commit | 841746210ac6444c2e15395e14856d0d889ffd9c (patch) | |
tree | b7a5a2b41443c0101e1a3a6cc5175cfb8229c440 /src/js/plugins/preview-thumbnails.js | |
parent | e50b35d195316a1aee28797de26b3d7b42daa0be (diff) | |
parent | 156abda66adeae369dce9d565e9c0ca21508e557 (diff) | |
download | plyr-841746210ac6444c2e15395e14856d0d889ffd9c.tar.lz plyr-841746210ac6444c2e15395e14856d0d889ffd9c.tar.xz plyr-841746210ac6444c2e15395e14856d0d889ffd9c.zip |
Merge pull request #1684 from sampotts/develop
v3.5.8
Diffstat (limited to 'src/js/plugins/preview-thumbnails.js')
-rw-r--r-- | src/js/plugins/preview-thumbnails.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/js/plugins/preview-thumbnails.js b/src/js/plugins/preview-thumbnails.js index 6cd09ef2..86eeebc8 100644 --- a/src/js/plugins/preview-thumbnails.js +++ b/src/js/plugins/preview-thumbnails.js @@ -104,7 +104,7 @@ class PreviewThumbnails { } load() { - // Togglethe regular seek tooltip + // Toggle the regular seek tooltip if (this.player.elements.display.seekTooltip) { this.player.elements.display.seekTooltip.hidden = this.enabled; } @@ -328,6 +328,15 @@ class PreviewThumbnails { this.player.elements.wrapper.appendChild(this.elements.scrubbing.container); } + destroy() { + if (this.elements.thumb.container) { + this.elements.thumb.container.remove(); + } + if (this.elements.scrubbing.container) { + this.elements.scrubbing.container.remove(); + } + } + showImageAtCurrentTime() { if (this.mouseDown) { this.setScrubbingContainerSize(); @@ -561,6 +570,11 @@ class PreviewThumbnails { return height; } + // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset) + if (this.sizeSpecifiedInCSS) { + return this.elements.thumb.imageContainer.clientHeight; + } + return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4); } @@ -601,7 +615,7 @@ class PreviewThumbnails { } determineContainerAutoSizing() { - if (this.elements.thumb.imageContainer.clientHeight > 20) { + if (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) { // This will prevent auto sizing in this.setThumbContainerSizeAndPos() this.sizeSpecifiedInCSS = true; } @@ -613,6 +627,12 @@ class PreviewThumbnails { const thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio); this.elements.thumb.imageContainer.style.height = `${this.thumbContainerHeight}px`; this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`; + } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) { + const thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio); + this.elements.thumb.imageContainer.style.width = `${thumbWidth}px`; + } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) { + const thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio); + this.elements.thumb.imageContainer.style.height = `${thumbHeight}px`; } this.setThumbContainerPos(); |