internal void BringToFront(Placemat placemat)
        {
            m_Placemats.Remove(placemat);
            m_Placemats.AddLast(placemat);

            UpdateElementsOrder();
        }
Exemple #2
0
        public static IGraphElement CreatePlacemat(this ElementBuilder elementBuilder, IStore store, IGTFPlacematModel model)
        {
            var ui = new Placemat();

            ui.Setup(model, store, elementBuilder.GraphView);
            return(ui);
        }
        internal void SendToBack(Placemat placemat)
        {
            m_Placemats.Remove(placemat);
            m_Placemats.AddFirst(placemat);

            UpdateElementsOrder();
        }
        internal void CyclePlacemat(Placemat placemat, CycleDirection direction)
        {
            var node = m_Placemats.Find(placemat);

            if (node == null)
            {
                return;
            }

            var next = direction == CycleDirection.Up ? node.Next : node.Previous;

            if (next != null)
            {
                m_Placemats.Remove(placemat);
                if (direction == CycleDirection.Down)
                {
                    m_Placemats.AddBefore(next, node);
                }
                else
                {
                    m_Placemats.AddAfter(next, node);
                }
            }

            UpdateElementsOrder();
        }
        public void AddPlacemat(Placemat placemat)
        {
            bool updateOrders = placemat.ZOrder == 0 || (m_Placemats.Count > 0 && placemat.ZOrder <= m_Placemats.Last.Value.ZOrder);

            m_Placemats.AddLast(placemat);
            Add(placemat);

            if (updateOrders)
            {
                UpdateElementsOrder();
            }
        }
        public bool GetPortCenterOverride(Port port, out Vector2 overriddenPosition)
        {
            Node rootNode = port.node;

            if (rootNode != null)
            {
                Node currNode;
                while ((currNode = rootNode.GetFirstAncestorOfType <Node>()) != null)
                {
                    rootNode = currNode;
                }

                //Find the furthest placemat containing the rootNode and that is collapsed (if any)
                Placemat placemat = m_Placemats.FirstOrDefault(p => p.Collapsed && p.WillDragNode(rootNode));

                if (placemat != null)
                {
                    return(placemat.GetPortCenterOverride(port.PortModel, out overriddenPosition));
                }
            }

            overriddenPosition = Vector3.zero;
            return(false);
        }
 void RemovePlacemat(Placemat placemat)
 {
     placemat.RemoveFromHierarchy();
     m_Placemats.Remove(placemat);
 }