Пример #1
0
 private void MouseReleasedEvent(UserCommandArgs userCommandArgs, KeyModifiers keyModifiers)
 {
     if (userCommandArgs is PointerCommandArgs pointerCommandArgs)
     {
         mouseActiveWindow = VisibleWindows.LastOrDefault(w => w.Interactive && w.Location.Contains(pointerCommandArgs.Position));
         mouseActiveWindow?.MouseReleased(pointerCommandArgs.Position, keyModifiers);
     }
     mouseActiveWindow = null;
 }
Пример #2
0
 private void MouseDraggingEvent(UserCommandArgs userCommandArgs, KeyModifiers keyModifiers)
 {
     if (userCommandArgs is PointerMoveCommandArgs moveCommandArgs)
     {
         if (null == mouseActiveWindow)
         {
             mouseActiveWindow = VisibleWindows.LastOrDefault(w => w.Interactive && w.Location.Contains(moveCommandArgs.Position));
         }
         mouseActiveWindow?.MouseDrag(moveCommandArgs.Position, moveCommandArgs.Delta, keyModifiers);
     }
 }
Пример #3
0
 private void WindowScrollEvent(UserCommandArgs userCommandArgs, KeyModifiers keyModifiers)
 {
     if (userCommandArgs is ScrollCommandArgs scrollCommandArgs)
     {
         mouseActiveWindow = VisibleWindows.LastOrDefault(w => w.Interactive && w.Location.Contains(scrollCommandArgs.Position));
         if (mouseActiveWindow != null)
         {
             mouseActiveWindow.MouseScroll(scrollCommandArgs.Position, scrollCommandArgs.Delta, keyModifiers);
         }
     }
 }
Пример #4
0
        private void MouseClickedEvent(UserCommandArgs userCommandArgs, KeyModifiers keyModifiers)
        {
            if (userCommandArgs is PointerCommandArgs pointerCommandArgs)
            {
                mouseDownPosition = pointerCommandArgs.Position;
                mouseActiveWindow = VisibleWindows.LastOrDefault(w => w.Interactive && w.Location.Contains(pointerCommandArgs.Position));
                if ((mouseActiveWindow != null) && (mouseActiveWindow != WindowsZOrder.Last()))
                {
                    BringWindowToTop(mouseActiveWindow);
                }

                mouseActiveWindow?.MousePressed(pointerCommandArgs.Position, keyModifiers);
            }
        }
Пример #5
0
        public void HandleUserInput(ElapsedTime elapsedTime)
        {
            if (UserInput.IsMouseLeftButtonPressed)
            {
                mouseDownPosition = new Point(UserInput.MouseX, UserInput.MouseY);
                mouseActiveWindow = VisibleWindows.LastOrDefault(w => w.Interactive && w.Location.Contains(mouseDownPosition));
                if ((mouseActiveWindow != null) && (mouseActiveWindow != WindowsZOrder.Last()))
                {
                    BringWindowToTop(mouseActiveWindow);
                }
            }

            if (UserInput.IsMouseWheelChanged)
            {
                mouseActiveWindow = VisibleWindows.LastOrDefault(w => w.Interactive && w.Location.Contains(mouseDownPosition));

                if (mouseActiveWindow != null)
                {
                    mouseActiveWindow.HandleUserInput();
                }
            }

            if (mouseActiveWindow != null)
            {
                if (UserInput.IsMouseLeftButtonPressed)
                {
                    mouseActiveWindow.MouseDown();
                }
                else if (UserInput.IsMouseLeftButtonReleased)
                {
                    mouseActiveWindow.MouseUp();
                }

                if (UserInput.IsMouseMoved)
                {
                    mouseActiveWindow.MouseMove();
                }

                if (Viewer.RealTime - LastUpdateRealTime >= 0.1)
                {
                    LastUpdateRealTime = Viewer.RealTime;
                    mouseActiveWindow.HandleUserInput();
                }

                if (UserInput.IsMouseLeftButtonReleased)
                {
                    mouseActiveWindow = null;
                }
            }
        }