protected void Gc_MouseEnter(object sender, GLMouseEventArgs e) { Gc_MouseLeave(sender, e); // leave current SetViewScreenCoord(ref e); currentmouseover = FindControlOver(e.ScreenCoord, out Point leftover); if (currentmouseover != null) { currentmouseover.Hover = true; SetControlLocation(ref e, currentmouseover); ((GLControlDisplay)this).SetCursor(currentmouseover.Cursor); if (currentmouseover.Enabled) { currentmouseover.OnMouseEnter(e); } } }
protected void Gc_MouseMove(object sender, GLMouseEventArgs e) { SetViewScreenCoord(ref e); //System.Diagnostics.Debug.WriteLine("WLoc {0} VP {1} SLoc {2} MousePos {3}", e.WindowLocation, e.ViewportLocation, e.ScreenCoord, FindDisplay().MouseWindowPosition); GLBaseControl c = FindControlOver(e.ScreenCoord, out Point leftover); // overcontrol ,or over display, or maybe outside display if (c != currentmouseover) // if different, either going active or inactive { mousedowninitialcontrol = null; // because we moved away from mouse down control, its now null if (currentmouseover != null) // for current, its a leave or its a drag.. { SetControlLocation(ref e, currentmouseover); if (currentmouseover.MouseButtonsDown != GLMouseEventArgs.MouseButtons.None) // click and drag, can't change control while mouse is down { // System.Diagnostics.Debug.WriteLine($"Captured WLoc {e.WindowLocation} VP {e.ViewportLocation} SLoc {e.ScreenCoord} Bnd {e.BoundsLocation} {currentmouseover?.Name} @ {currentmouseoverscreenpos}"); GlobalMouseMove?.Invoke(e); // we move, with the currentmouseover if (currentmouseover.Enabled) // and send to control if enabled { currentmouseover.OnMouseMove(e); } return; } currentmouseover.Hover = false; // we are leaving this one if (currentmouseover.Enabled) { currentmouseover.OnMouseLeave(e); } } currentmouseover = c; // change to new value if (currentmouseover != null) // now, are we going over a new one? { SetControlLocation(ref e, currentmouseover); // reset location etc // System.Diagnostics.Debug.WriteLine($"Changed to WLoc {e.WindowLocation} VP {e.ViewportLocation} SLoc {e.ScreenCoord} bnd {e.BoundsLocation} {currentmouseover?.Name} @ {currentmouseoverscreenpos}"); currentmouseover.Hover = true; GlobalMouseMove?.Invoke(e); // we move, with the new currentmouseover ((GLControlDisplay)this).SetCursor(currentmouseover.Cursor); if (currentmouseover.Enabled) // and send to control if enabled { currentmouseover.OnMouseEnter(e); } } else { GlobalMouseMove?.Invoke(e); // we move, with no mouse over ((GLControlDisplay)this).SetCursor(GLWindowControl.GLCursorType.Normal); if (this.Enabled) // not over any control (due to screen coord clip space), so send thru the displaycontrol { this.OnMouseMove(e); } } } else { // over same control if (currentmouseover != null) { SetControlLocation(ref e, currentmouseover); // reset location etc //System.Diagnostics.Debug.WriteLine($"move WLoc {e.WindowLocation} VP {e.ViewportLocation} SLoc {e.ScreenCoord} Loc {e.Location} Bnd {e.BoundsLocation} {currentmouseover?.Name}"); GlobalMouseMove?.Invoke(e); // we move, with the new currentmouseover if (currentmouseover.Enabled) { currentmouseover.OnMouseMove(e); } } else { GlobalMouseMove?.Invoke(e); // we move, with no mouse over if (this.Enabled) // not over any control (due to screen coord clip space), so send thru the displaycontrol { this.OnMouseMove(e); } } } }