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); }
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); }
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); }
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); }