From d2ab30e7a69bfe7efda63ae75812207377917bd3 Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Sun, 30 Mar 2025 18:50:27 +0000
Subject: [PATCH] Merge branch 'Flexalon-UI-Layouts' into develop

---
 Assets/Flexalon/Runtime/Core/FlexalonResult.cs |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/Assets/Flexalon/Runtime/Core/FlexalonResult.cs b/Assets/Flexalon/Runtime/Core/FlexalonResult.cs
new file mode 100644
index 0000000..b120c95
--- /dev/null
+++ b/Assets/Flexalon/Runtime/Core/FlexalonResult.cs
@@ -0,0 +1,72 @@
+using System;
+using UnityEngine;
+
+namespace Flexalon
+{
+    /// <summary>
+    /// This component is added to each object in a layout. It stores the results of the layout process
+    /// so they can be loaded from a scene/prefab without rerunning layout.
+    /// </summary>
+    [ExecuteAlways, DisallowMultipleComponent]
+    public class FlexalonResult : MonoBehaviour
+    {
+        /// <summary> Parent layout </summary>
+        public Transform Parent;
+
+        /// <summary> Index in layout </summary>
+        public int SiblingIndex;
+
+        /// <summary> Arranged position in parent layout space. </summary>
+        public Vector3 LayoutPosition = Vector3.zero;
+
+        /// <summary> Arranged rotation in parent layout space. </summary>
+        public Quaternion LayoutRotation = Quaternion.identity;
+
+        /// <summary> Bounds deteremined by Adapter.Measure function. </summary>
+        public Bounds AdapterBounds = new Bounds();
+
+        /// <summary> Combined bounds of Layout.Measure function and Adapter.Measure functions. </summary>
+        public Bounds LayoutBounds = new Bounds();
+
+        /// <summary> Bounds after layout, scale and rotation used in the parent layout. </summary>
+        public Bounds RotatedAndScaledBounds = new Bounds();
+
+        /// <summary> What the component updater thinks the scale should be in layout space. </summary>
+        public Vector3 ComponentScale = Vector3.one;
+
+        /// <summary> Allocated size for this child when using fill size. </summary>
+        public Vector3 FillSize = Vector2.zero;
+
+        /// <summary> Reduced size if parent doesn't have space for child. </summary>
+        public Vector3 ShrinkSize = Math.MaxVector;
+
+        /// <summary> Expected local position set by the layout system. </summary>
+        public Vector3 TargetPosition = Vector3.zero;
+
+        /// <summary> Expected local rotation set by the layout system. </summary>
+        public Quaternion TargetRotation = Quaternion.identity;
+
+        /// <summary> Expected local scale set by the layout system. </summary>
+        public Vector3 TargetScale = Vector3.one;
+
+        /// <summary> Expected rect size set by the layout system. </summary>
+        public Vector3 TargetRectSize = Vector2.zero;
+
+        /// <summary> Last position set by transform updater. Used to detect unexpected changes. </summary>
+        public Vector3 TransformPosition = Vector3.zero;
+
+        /// <summary> Last rotation set by transform updater. Used to detect unexpected changes. </summary>
+        public Quaternion TransformRotation = Quaternion.identity;
+
+        /// <summary> Last scale set by transform updater. Used to detect unexpected changes. </summary>
+        public Vector3 TransformScale = Vector3.one;
+
+        /// <summary> Last rect size set by layout system. Used to detect unexpected changes. </summary>
+        public Vector2 TransformRectSize = Vector2.zero;
+
+        void Awake()
+        {
+            hideFlags = HideFlags.HideInInspector;
+        }
+    };
+}
\ No newline at end of file

--
Gitblit v1.9.3