示例#1
0
        void RebuildCollapsedElements()
        {
            m_CollapsedElements.Clear();

            var graphElements = m_GraphView.graphElements.ToList()
                                .Where(e => !(e is Edge) && (e.parent is GraphView.Layer) && (e.capabilities & Capabilities.Selectable) != 0)
                                .ToList();

            var collapsedElementsElsewhere = new List <GraphElement>();

            RecurseRebuildCollapsedElements_LocalFunc(this, graphElements, collapsedElementsElsewhere);

            var nodes = new HashSet <Node>(AllCollapsedElements.OfType <Node>());

            foreach (var edge in m_GraphView.edges.ToList())
            {
                if (AnyNodeIsConnectedToPort(nodes, edge.input) && AnyNodeIsConnectedToPort(nodes, edge.output))
                {
                    m_CollapsedElements.Add(edge);
                }
            }

            foreach (var ge in collapsedElementsElsewhere)
            {
                m_CollapsedElements.Remove(ge);
            }
        }
示例#2
0
        void UpdateCollapsedNodeEdges()
        {
            if (m_GraphView == null)
            {
                return;
            }

            //We need to update all the edges whose either port is in the placemat
            var touchedEdges = new HashSet <Edge>();

            var nodes = new HashSet <Node>(AllCollapsedElements.OfType <Node>());

            foreach (var edge in m_GraphView.edges.ToList())
            {
                if (AnyNodeIsConnectedToPort(nodes, edge.input) || AnyNodeIsConnectedToPort(nodes, edge.output))
                {
                    touchedEdges.Add(edge);
                }
            }

            foreach (var edge in touchedEdges)
            {
                edge.ForceUpdateEdgeControl();
            }
        }
示例#3
0
        internal bool WillDragNode(Node node)
        {
            if (Collapsed)
            {
                return(AllCollapsedElements.Contains(node));
            }

            return(ActOnGraphElementsOver(t => node == t, true));
        }
示例#4
0
        internal void HideCollapsedEdges()
        {
            var nodes = new HashSet <Node>(AllCollapsedElements.OfType <Node>());

            foreach (var edge in m_GraphView.edges.ToList())
            {
                if (AnyNodeIsConnectedToPort(nodes, edge.input) && AnyNodeIsConnectedToPort(nodes, edge.output))
                {
                    if (edge.style.visibility != Visibility.Hidden)
                    {
                        edge.style.visibility = Visibility.Hidden;
                        m_CollapsedElements.Add(edge);
                    }
                }
            }
        }