Exemplo n.º 1
0
        public EventPropagation DragUpdated(IMGUIEvent evt, IEnumerable <ISelectable> selection, IDropTarget dropTarget)
        {
            GroupNode firstAncestorOfType = base.parent.GetFirstAncestorOfType <GroupNode>();
            bool      flag = false;

            foreach (ISelectable current in selection)
            {
                if (current != firstAncestorOfType)
                {
                    GraphElement element    = current as GraphElement;
                    Event        imguiEvent = evt.imguiEvent;
                    if (imguiEvent.shift)
                    {
                        if (firstAncestorOfType.ContainsElement(element))
                        {
                            firstAncestorOfType.RemoveElement(element);
                        }
                    }
                    else if (!firstAncestorOfType.ContainsElement(element) && element.GetContainingGroupNode() == null)
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                base.AddToClassList("dragEntered");
            }
            else
            {
                base.RemoveFromClassList("dragEntered");
            }
            return(EventPropagation.Stop);
        }
Exemplo n.º 2
0
        public EventPropagation DragUpdated(IMGUIEvent evt, IEnumerable <ISelectable> selection, IDropTarget dropTarget)
        {
            GroupNode group   = parent.GetFirstAncestorOfType <GroupNode>();
            bool      canDrop = false;

            foreach (ISelectable selectedElement in selection)
            {
                if (selectedElement == group)
                {
                    continue;
                }

                var   selectedGraphElement = selectedElement as GraphElement;
                Event e = evt.imguiEvent;

                if (e.shift)
                {
                    if (group.ContainsElement(selectedGraphElement))
                    {
                        group.RemoveElement(selectedGraphElement);
                    }
                }
                else
                {
                    if (!group.ContainsElement(selectedGraphElement) && selectedGraphElement.GetContainingGroupNode() == null)
                    {
                        canDrop = true;
                    }
                }
            }

            if (canDrop)
            {
                AddToClassList("dragEntered");
            }
            else
            {
                RemoveFromClassList("dragEntered");
            }

            return(EventPropagation.Stop);
        }
Exemplo n.º 3
0
        public EventPropagation DragPerform(IMGUIEvent evt, IEnumerable <ISelectable> selection, IDropTarget dropTarget)
        {
            GroupNode firstAncestorOfType = base.parent.GetFirstAncestorOfType <GroupNode>();

            foreach (ISelectable current in selection)
            {
                if (current != firstAncestorOfType)
                {
                    GraphElement element = current as GraphElement;
                    if (!firstAncestorOfType.ContainsElement(element) && element.GetContainingGroupNode() == null)
                    {
                        firstAncestorOfType.AddElement(element);
                    }
                }
            }
            base.RemoveFromClassList("dragEntered");
            return(EventPropagation.Stop);
        }
Exemplo n.º 4
0
        public EventPropagation DragPerform(IMGUIEvent evt, IEnumerable <ISelectable> selection, IDropTarget dropTarget)
        {
            GroupNode group = parent.GetFirstAncestorOfType <GroupNode>();

            foreach (ISelectable selectedElement in selection)
            {
                if (selectedElement != group)
                {
                    var selectedGraphElement = selectedElement as GraphElement;

                    if (group.ContainsElement(selectedGraphElement) || selectedGraphElement.GetContainingGroupNode() != null)
                    {
                        continue;
                    }

                    group.AddElement(selectedGraphElement);
                }
            }

            RemoveFromClassList("dragEntered");

            return(EventPropagation.Stop);
        }