private void SortControlsByInfo() { if (_needSort) { var gumps = Gumps.Where(s => s.ControlInfo.Layer != UILayer.Default).ToArray(); int over = 0; int under = Gumps.Count - 1; foreach (Control c in gumps) { if (c.ControlInfo.Layer == UILayer.Under) { for (int i = 0; i < Gumps.Count; i++) { if (Gumps[i] == c) { Gumps.RemoveAt(i); Gumps.Insert(under, c); } } } else if (c.ControlInfo.Layer == UILayer.Over) { for (int i = 0; i < Gumps.Count; i++) { if (Gumps[i] == c) { Gumps.RemoveAt(i); Gumps.Insert(over++, c); } } } } //_gumps.Sort((a, b) => a.ControlInfo.Layer.CompareTo(b.ControlInfo.Layer)); _needSort = false; } }
private Control GetMouseOverControl(Point position) { if (_isDraggingControl) { return(DraggingControl); } var controls = IsModalControlOpen ? Gumps.Where(s => s.ControlInfo.IsModal) : Gumps; Control[] mouseOverControls = null; foreach (Control c in controls) { Control[] ctrls = c.HitTest(position); if (ctrls != null) { mouseOverControls = ctrls; break; } } if (mouseOverControls != null) { foreach (Control t in mouseOverControls) { if (t.AcceptMouseInput) { return(t); } } } return(null); }
public Control[] GetMouseOverControls(Point position) { return(Gumps.Where(o => o.HitTest(position) != null).ToArray()); }