예제 #1
0
        public static bool OnMouseMove(int x, int y)
        {
            UIElement lastSelection = currentSelection;

            MousePosition = new Click(x, y, false, false, false, false);
            Point position = new Point(MousePosition.X, MousePosition.Y);

            if (currentSelection != null && currentSelection.OnMouseMove != null)
            {
                currentSelection.OnMouseMove(null, new MouseEventArgs(MousePosition, LastMousePosition));
            }

            if (UserInterface.Pick(position))
            {
                currentSelection = UserInterface.Selection;
            }
            else
            {
                currentSelection = null;
            }

            if (currentSelection != lastSelection)
            {
                if (lastSelection != null && lastSelection.OnMouseLeave != null)
                {
                    lastSelection.OnMouseLeave(null, new MouseEventArgs(MousePosition, LastMousePosition));
                }
                if (currentSelection != null && currentSelection.OnMouseEnter != null)
                {
                    currentSelection.OnMouseEnter(null, new MouseEventArgs(MousePosition, LastMousePosition));
                }
            }

            return(currentSelection != null);
        }
예제 #2
0
        public static bool OnMouseMove(int x, int y)
        {
            UIElement currentSelection = UserInterface.currentSelection;

            UserInterface.MousePosition = new Click(x, y, false, false, false, false);
            Point Location = new Point(UserInterface.MousePosition.X, UserInterface.MousePosition.Y);

            if (UserInterface.currentSelection != null && UserInterface.currentSelection.OnMouseMove != null)
            {
                UserInterface.currentSelection.OnMouseMove((object)null, new MouseEventArgs(UserInterface.MousePosition, UserInterface.LastMousePosition));
            }
            UserInterface.currentSelection = !UserInterface.Pick(Location) ? (UIElement)null : UserInterface.Selection;
            if (UserInterface.currentSelection != currentSelection)
            {
                if (currentSelection != null && currentSelection.OnMouseLeave != null)
                {
                    currentSelection.OnMouseLeave((object)null, new MouseEventArgs(UserInterface.MousePosition, UserInterface.LastMousePosition));
                }
                if (UserInterface.currentSelection != null && UserInterface.currentSelection.OnMouseEnter != null)
                {
                    UserInterface.currentSelection.OnMouseEnter((object)null, new MouseEventArgs(UserInterface.MousePosition, UserInterface.LastMousePosition));
                }
            }
            return(UserInterface.currentSelection != null);
        }