diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-06 16:38:27 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-06 16:38:27 +0200 |
| commit | 7b127b4cbf2f83b17a7abc2ccc4af5fda178a476 (patch) | |
| tree | d6469ae1147cd88eac9a6d912dd8a333cdfa90f1 /frontend/app/views/tile/tile.utils.js | |
| parent | 194ead8894b77638de5db7626b7c35cd754c11c7 (diff) | |
making 3d models smaller
Diffstat (limited to 'frontend/app/views/tile/tile.utils.js')
| -rw-r--r-- | frontend/app/views/tile/tile.utils.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/frontend/app/views/tile/tile.utils.js b/frontend/app/views/tile/tile.utils.js index dc19540..c0f92a5 100644 --- a/frontend/app/views/tile/tile.utils.js +++ b/frontend/app/views/tile/tile.utils.js @@ -82,9 +82,12 @@ export const unitsDimension = (tile, dimension, bounds, videoBounds) => { return value + "px" } -export const videoUnits = (value, bounds, videoBounds) => ( - Math.round(value * bounds.width / videoBounds.width) + 'px' -) +export const videoUnits = (value, bounds, videoBounds) => { + if ((videoBounds.width / videoBounds.height) > (bounds.width / bounds.height)) { + return Math.round(value * bounds.height / videoBounds.height) + 'px' + } + return Math.round(value * bounds.width / videoBounds.width) + 'px' +} export const hexToRgb = (hex) => { if (!hex) { |
