diff options
author | Sam Potts <sam@potts.es> | 2020-02-10 11:28:59 +0000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2020-02-10 11:28:59 +0000 |
commit | 59e3afba03e1d6b3cf04661e5181ec4a4ba0f57e (patch) | |
tree | b2298d9c6f04e3fd5def4df342b5eed74176c5fd /src/js/plugins | |
parent | ea350f9d1ded176979b4a8a9a7bf9a66e8ae9a53 (diff) | |
parent | db05322ba2c47606599f635c749db3bdd8ee6c82 (diff) | |
download | plyr-59e3afba03e1d6b3cf04661e5181ec4a4ba0f57e.tar.lz plyr-59e3afba03e1d6b3cf04661e5181ec4a4ba0f57e.tar.xz plyr-59e3afba03e1d6b3cf04661e5181ec4a4ba0f57e.zip |
Merge branch 'develop' of github.com:sampotts/plyr into develop
Diffstat (limited to 'src/js/plugins')
-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(); |