miepzerino
2025-03-30 d2ab30e7a69bfe7efda63ae75812207377917bd3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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;
        }
    };
}