From 1aebf5dbd4ccca20744a0e1fcc1df81ae72ba9b8 Mon Sep 17 00:00:00 2001 From: maurofmferrao Date: Thu, 17 Oct 2024 14:04:34 +0100 Subject: [PATCH] Layout Editor: Elements don't rescale after saving relates to xibosignage/xibo#3534 --- ui/src/layout-editor/viewer.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/src/layout-editor/viewer.js b/ui/src/layout-editor/viewer.js index 4e77d61a6c..15dcf5143f 100644 --- a/ui/src/layout-editor/viewer.js +++ b/ui/src/layout-editor/viewer.js @@ -2821,10 +2821,20 @@ Viewer.prototype.initMoveable = function() { e.target.style.transform = e.drag.transform; // If selected object is a widget, get parent instead - const selectedObject = (lD.selectedObject.type == 'widget') ? + let selectedObject = (lD.selectedObject.type == 'widget') ? lD.selectedObject.parent : lD.selectedObject; - // Update element dimension properties + // If it's an element, we need to get the object from the actual structure + if (selectedObject.type == 'element') { + selectedObject = + lD.getObjectByTypeAndId( + 'element', + selectedObject.elementId, + 'widget_' + selectedObject.regionId + '_' + selectedObject.widgetId, + ); + } + + // Update object dimension properties selectedObject.transform({ width: parseFloat(e.width / self.containerObjectDimensions.scale), height: parseFloat(e.height / self.containerObjectDimensions.scale),