예제 #1
0
 private void OnChildAdded(GraphElement element)
 {
     element.AddToClassList("stack-child-element");
     element.ResetPositionProperties();
     element.RegisterCallback <DetachFromPanelEvent>(OnChildDetachedFromPanel);
     UpdatePlaceholderVisibility();
 }
        private void AddToSelectionNoUndoRecord(GraphElement graphElement)
        {
            graphElement.selected = true;
            selection.Add(graphElement);
            graphElement.OnSelected();

            // To ensure that the selected GraphElement gets unselected if it is removed from the GraphView.
            graphElement.RegisterCallback <DetachFromPanelEvent>(OnSelectedElementDetachedFromPanel);

            graphElement.MarkDirtyRepaint();
        }
        internal void ChangeLayer(GraphElement element)
        {
            if (!m_ContainerLayers.ContainsKey(element.layer))
            {
                AddLayer(element.layer);
            }

            bool selected = element.selected;

            if (selected)
            {
                element.UnregisterCallback <DetachFromPanelEvent>(OnSelectedElementDetachedFromPanel);
            }

            GetLayer(element.layer).Add(element);

            if (selected)
            {
                element.RegisterCallback <DetachFromPanelEvent>(OnSelectedElementDetachedFromPanel);
            }
        }