FSO.IDE.EditorComponent.UI.BHAVContainer.CleanPosition C# (CSharp) Méthode

CleanPosition() public méthode

public CleanPosition ( ) : void
Résultat void
        public void CleanPosition()
        {
            var notTraversed = new HashSet<PrimitiveBox>(Primitives);
            int xOff = 0;
            while (notTraversed.Count > 0)
            {
                var instructionTree = new List<List<PrimitiveBox>>();

                recurseTree(notTraversed, instructionTree, notTraversed.ElementAt(0), 0);

                int treeWidth = 0;
                int yPos = 0;
                var treePrims = new List<PrimitiveBox>();
                foreach (var row in instructionTree)
                {
                    int rowWidth = -20;
                    foreach (var inst in row)
                    {
                        rowWidth += inst.Width + 45;
                    }
                    int xPos = rowWidth / -2;
                    int maxHeight = 0;
                    foreach (var inst in row)
                    {
                        treePrims.Add(inst);
                        inst.Position = new Vector2(xPos, yPos);
                        if (inst.Height > maxHeight) maxHeight = inst.Height;
                        xPos += inst.Width + 45;
                    }
                    yPos += 45 + maxHeight;
                    if (rowWidth > treeWidth) treeWidth = rowWidth;
                }

                int halfWidth = treeWidth / 2;
                foreach (var ui in treePrims)
                {
                    ui.Position = new Vector2(ui.X + xOff + halfWidth + 20, ui.Y);
                }
                xOff += treeWidth + 60;
            }
        }