SetRelativeX() public method

public SetRelativeX ( ) : void
return void
        public void AutoPosition()
        {
            const float depthSpacing = 4;

            for (int i = 0; i < mNodesAsList.Count; i++)
            {
                HierarchyNode node = mNodesAsList[i];

                node.RelativeY = -depthSpacing;

                IAttachable parent = GetParent(node.ObjectRepresenting);

                if (parent == null)
                {
                    node.AttachTo(null, false);
                    node.Y = 5;
                }
                else
                {
                    HierarchyNode parentNode = GetNodeFromAttachable(parent);
                    node.AttachTo(parentNode, false);
                }
            }

            mUnparentedNodes.Clear();

            // Gotta do this after all attachments have been made
            for (int i = 0; i < mNodesAsList.Count; i++)
            {
                HierarchyNode node = mNodesAsList[i];

                if (node.Parent != null)
                {
                    node.SetRelativeX();
                    node.ForceUpdateDependencies();
                }
                else
                {
                    float xToStartAt = 0;

                    if (mUnparentedNodes.Count != 0)
                    {
                        xToStartAt = mUnparentedNodes.Last.X +
                                     mUnparentedNodes.Last.Width / 2.0f;
                    }

                    node.Y = 5;
                    node.X = xToStartAt + node.Width / 2.0f;

                    mUnparentedNodes.Add(node);
                }
            }

            UpdateSelectionMarker();
        }