RegisterForRedraw ();
}
- Thread.Sleep (5);
+ Thread.Sleep (2);
}
}
base.onMouseMove (sender, e);
GraphicObject oldHW = imlVE.HoverWidget;
Rectangle scr = this.ScreenCoordinates (this.getSlot ());
- imlVE.ProcessMouseMove (e.X - scr.X, e.Y - scr.Y);
+ ProcessMouseMove (e.X - scr.X, e.Y - scr.Y);
if (oldHW == imlVE.HoverWidget)
return;
RegisterForRedraw ();
}
#endregion
+
+ public bool ProcessMouseMove(int x, int y)
+ {
+ int deltaX = x - imlVE.Mouse.X;
+ int deltaY = y - imlVE.Mouse.Y;
+ imlVE.Mouse.X = x;
+ imlVE.Mouse.Y = y;
+ MouseMoveEventArgs e = new MouseMoveEventArgs (x, y, deltaX, deltaY);
+ e.Mouse = imlVE.Mouse;
+
+ if (imlVE.activeWidget != null) {
+ //TODO, ensure object is still in the graphic tree
+ //send move evt even if mouse move outside bounds
+ imlVE.activeWidget.onMouseMove (this, e);
+ return true;
+ }
+
+ if (imlVE.HoverWidget != null) {
+ //TODO, ensure object is still in the graphic tree
+ //check topmost graphicobject first
+ GraphicObject tmp = imlVE.HoverWidget;
+ GraphicObject topc = null;
+ while (tmp is GraphicObject) {
+ topc = tmp;
+ tmp = tmp.LogicalParent as GraphicObject;
+ }
+ int idxhw = imlVE.GraphicTree.IndexOf (topc);
+ if (idxhw != 0) {
+ int i = 0;
+ while (i < idxhw) {
+ if (imlVE.GraphicTree [i].LogicalParent == imlVE.GraphicTree [i].Parent) {
+ if (imlVE.GraphicTree [i].MouseIsIn (e.Position)) {
+ while (imlVE.HoverWidget != null) {
+ imlVE.HoverWidget.onMouseLeave (imlVE.HoverWidget, e);
+ imlVE.HoverWidget = imlVE.HoverWidget.LogicalParent as GraphicObject;
+ }
+
+ imlVE.GraphicTree [i].checkHoverWidget (e);
+ return true;
+ }
+ }
+ i++;
+ }
+ }
+
+
+ if (imlVE.HoverWidget.MouseIsIn (e.Position)) {
+ imlVE.HoverWidget.checkHoverWidget (e);
+ return true;
+ } else {
+ imlVE.HoverWidget.onMouseLeave (imlVE.HoverWidget, e);
+ //seek upward from last focused graph obj's
+ while (imlVE.HoverWidget.LogicalParent as GraphicObject != null) {
+ imlVE.HoverWidget = imlVE.HoverWidget.LogicalParent as GraphicObject;
+ if (imlVE.HoverWidget.MouseIsIn (e.Position)) {
+ imlVE.HoverWidget.checkHoverWidget (e);
+ return true;
+ } else
+ imlVE.HoverWidget.onMouseLeave (imlVE.HoverWidget, e);
+ }
+ }
+ }
+
+ //top level graphic obj's parsing
+ lock (imlVE.GraphicTree) {
+ for (int i = 0; i < imlVE.GraphicTree.Count; i++) {
+ GraphicObject g = imlVE.GraphicTree [i];
+ if (g.MouseIsIn (e.Position)) {
+ g.checkHoverWidget (e);
+ if (g is Window)
+ imlVE.PutOnTop (g);
+ return true;
+ }
+ }
+ }
+ imlVE.HoverWidget = null;
+ return false;
+ }
}
}
MouseMoveEventArgs e = new MouseMoveEventArgs (x, y, deltaX, deltaY);
e.Mouse = Mouse;
- if (_activeWidget != null) {
+ if (activeWidget != null) {
//TODO, ensure object is still in the graphic tree
//send move evt even if mouse move outside bounds
- _activeWidget.onMouseMove (this, e);
+ activeWidget.onMouseMove (this, e);
return true;
}