コード例 #1
0
        void DoUntrackGraphElement(Port port)
        {
            port.UnregisterCallback <GeometryChangedEvent>(OnPortGeometryChanged);

            VisualElement current = port.hierarchy.parent;

            while (current != null)
            {
                if (current is GraphView.Layer)
                {
                    break;
                }
                if (current != port.node) // if we encounter our node ignore it but continue in the case there are nodes inside nodes
                {
                    port.UnregisterCallback <GeometryChangedEvent>(OnGeometryChanged);
                }

                current = current.hierarchy.parent;
            }
            if (port.node != null)
            {
                port.node.UnregisterCallback <GeometryChangedEvent>(OnGeometryChanged);
            }
        }
コード例 #2
0
 void UntrackGraphElement(Port port)
 {
     port.UnregisterCallback <AttachToPanelEvent>(OnPortAttach);
     port.UnregisterCallback <DetachFromPanelEvent>(OnPortDetach);
     DoUntrackGraphElement(port);
 }