using System; using UnityEngine; namespace Flexalon { /// /// 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. /// [ExecuteAlways, DisallowMultipleComponent] public class FlexalonResult : MonoBehaviour { /// Parent layout public Transform Parent; /// Index in layout public int SiblingIndex; /// Arranged position in parent layout space. public Vector3 LayoutPosition = Vector3.zero; /// Arranged rotation in parent layout space. public Quaternion LayoutRotation = Quaternion.identity; /// Bounds deteremined by Adapter.Measure function. public Bounds AdapterBounds = new Bounds(); /// Combined bounds of Layout.Measure function and Adapter.Measure functions. public Bounds LayoutBounds = new Bounds(); /// Bounds after layout, scale and rotation used in the parent layout. public Bounds RotatedAndScaledBounds = new Bounds(); /// What the component updater thinks the scale should be in layout space. public Vector3 ComponentScale = Vector3.one; /// Allocated size for this child when using fill size. public Vector3 FillSize = Vector2.zero; /// Reduced size if parent doesn't have space for child. public Vector3 ShrinkSize = Math.MaxVector; /// Expected local position set by the layout system. public Vector3 TargetPosition = Vector3.zero; /// Expected local rotation set by the layout system. public Quaternion TargetRotation = Quaternion.identity; /// Expected local scale set by the layout system. public Vector3 TargetScale = Vector3.one; /// Expected rect size set by the layout system. public Vector3 TargetRectSize = Vector2.zero; /// Last position set by transform updater. Used to detect unexpected changes. public Vector3 TransformPosition = Vector3.zero; /// Last rotation set by transform updater. Used to detect unexpected changes. public Quaternion TransformRotation = Quaternion.identity; /// Last scale set by transform updater. Used to detect unexpected changes. public Vector3 TransformScale = Vector3.one; /// Last rect size set by layout system. Used to detect unexpected changes. public Vector2 TransformRectSize = Vector2.zero; void Awake() { hideFlags = HideFlags.HideInInspector; } }; }