From 21c364d3904d8e08b7b01309fd7c2169260c1089 Mon Sep 17 00:00:00 2001 From: Ruben Pingol <128448242+rubenpingol-xibo@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:30:47 +0800 Subject: [PATCH] Weather Widget: Fix elements preview positioning with defaultScaler function (#2178) relates to xibosignage/xibo#3196 --- modules/src/player.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/src/player.js b/modules/src/player.js index 1fc6e4a1d6..8143af5980 100644 --- a/modules/src/player.js +++ b/modules/src/player.js @@ -270,6 +270,7 @@ $(function() { url, meta, } = widget; + widget.items = []; if (Object.keys(elements.groups).length > 0 || Object.keys(elements.standalone).length > 0) { @@ -384,16 +385,11 @@ $(function() { if (typeof window[ `onElementParseData_${item.templateData.id}` ] === 'function') { - const onElementParseData = window[ - `onElementParseData_${item.templateData.id}` - ]; - - if (onElementParseData) { - dataItem[item.dataOverride] = onElementParseData( + dataItem[item.dataOverride] = + window[`onElementParseData_${item.templateData.id}`]( dataItem[extendDataWith], {...item.templateData, data: dataItem}, ); - } } let groupItemStyles = { @@ -592,6 +588,8 @@ $(function() { $grpContent.find(`.${groupSlotObj.id}--item`), ); }); + + widget.items.push($grpContent); } }); } @@ -693,6 +691,8 @@ $(function() { }, $grpItem.find(`.${grpCln}--item`), ); + + widget.items.push($grpItem); } }); } else { @@ -715,6 +715,19 @@ $(function() { } }); } + + // Run defaultScaler for elements + defaultScaler( + widget.widgetId, + $content, + widget.items, + Object.assign( + widget.properties, + globalOptions, + {duration: widget.duration}, + ), + meta, + ); } }