diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-05 12:58:11 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-05 12:58:11 +0200 |
| commit | 236aa3a1294310936e8a6752fed5689c1464225b (patch) | |
| tree | eca436127a97780d2df0bfd01faa9ff60dde8094 /frontend/app/views/tile/tile.utils.js | |
| parent | 20fc5036f8de9109b21e901d04f0dac651e40fc6 (diff) | |
possibly fixing video tiles
Diffstat (limited to 'frontend/app/views/tile/tile.utils.js')
| -rw-r--r-- | frontend/app/views/tile/tile.utils.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/frontend/app/views/tile/tile.utils.js b/frontend/app/views/tile/tile.utils.js index b946716..f172545 100644 --- a/frontend/app/views/tile/tile.utils.js +++ b/frontend/app/views/tile/tile.utils.js @@ -49,6 +49,7 @@ export const generateVideoStyle = (tile, bounds) => { style.height = "auto" break case 'cover': + style.backgroundSize = tile.settings.video_style if (tile.settings.width && (tile.settings.width / tile.settings.height) > (bounds.width / bounds.height)) { style.width = Math.round((tile.settings.width / tile.settings.height) * bounds.height) style.height = bounds.height @@ -58,6 +59,7 @@ export const generateVideoStyle = (tile, bounds) => { } break case 'contain': + style.backgroundSize = tile.settings.video_style if (tile.settings.width && (tile.settings.width / tile.settings.height) > (bounds.width / bounds.height)) { style.width = bounds.width style.height = Math.round((tile.settings.height / tile.settings.width) * bounds.width) @@ -83,7 +85,9 @@ export const unitsDimension = (tile, dimension, bounds, videoBounds) => { } export const videoUnits = (value, bounds, videoBounds) => ( - Math.round(value / videoBounds.width * bounds.width) + 'px' + (videoBounds.backgroundSize === "contain") + ? Math.round(value / videoBounds.height * bounds.height) + 'px' + : Math.round(value / videoBounds.width * bounds.width) + 'px' ) export const hexToRgb = (hex) => { |
