protected void OnMouseDown(MouseDownEvent e) { if (e.currentTarget is ISelectable) { if (base.CanStartManipulation(e)) { if ((base.target as ISelectable).HitTest(e.localMousePosition)) { GraphElement graphElement = e.currentTarget as GraphElement; if (graphElement != null) { VisualElement parent = graphElement.shadow.parent; while (parent != null && !(parent is GraphView)) { parent = parent.shadow.parent; } GraphView selectionContainer = parent as GraphView; if (graphElement.IsSelected(selectionContainer) && e.ctrlKey) { graphElement.Unselect(selectionContainer); } else { graphElement.Select(selectionContainer, e.shiftKey || e.ctrlKey); } } } } } }