public virtual List <GUIElement> GetElementsUnderPoint(Vector2 location, InputManager.LogicalButtonState buttons) { List <GUIElement> elements = new List <GUIElement>(); if (Inited && !IgnoreMouse) { if (Rect.PointInRect(location)) { ProcessMouseEvent(location, buttons); elements.Add(this); } Vector2 childLoc = location - Rect.GetPixelOrigin(); foreach (var child in Children) { List <GUIElement> childElements = child.GetElementsUnderPoint(childLoc, buttons); if (childElements.Count > 0) { elements.AddRange(childElements.ToArray()); } } } return(elements); }