From 236aa3a1294310936e8a6752fed5689c1464225b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 5 Apr 2021 12:58:11 +0200 Subject: possibly fixing video tiles --- frontend/app/views/tile/tile.utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'frontend/app/views/tile/tile.utils.js') 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) => { -- cgit v1.2.3-70-g09d2