From cda9c115283be8e4e224f6036ba07e5eca243289 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 31 Mar 2021 17:37:40 +0200 Subject: refactor tile forms into own files. add full-width marquee support --- frontend/app/views/tile/tile.utils.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 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 46d7764..043732b 100644 --- a/frontend/app/views/tile/tile.utils.js +++ b/frontend/app/views/tile/tile.utils.js @@ -3,6 +3,13 @@ export const generateTransform = (tile, box, bounds, videoBounds) => { if (is_tiled) { return 'translateZ(0)' } + + const is_full_width = (tile.type === 'text' && tile.settings.is_marquee) + + if (is_full_width) { + x = 0 + } + if (box) { x += box.dx y += box.dy @@ -77,4 +84,23 @@ export const unitsDimension = (tile, dimension, bounds, videoBounds) => { export const videoUnits = (value, bounds, videoBounds) => ( Math.round(value / videoBounds.width * bounds.width) + 'px' -) \ No newline at end of file +) + +export const hexToRgb = (hex) => { + if (!hex) { + return null + } + let result; + if (hex.length === 7) { + result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) + } else if (hex.length === 4) { + result = /^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(hex) + } else { + return { r: 255, g: 0, b: 255 } + } + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null +} \ No newline at end of file -- cgit v1.2.3-70-g09d2