Example #1
0
 private void commitTouchUndo()
 {
     if (touchUndoPosition != null)
     {
         SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
         if (activeWindow != null)
         {
             activeWindow.pushUndoState(touchUndoPosition);
         }
         touchUndoPosition = null;
     }
 }
Example #2
0
 void mouseWheelTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     ThreadManager.invokeAndWait(() =>
     {
         if (!currentlyInMotion && mouseUndoPosition != null)
         {
             SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
             if (activeWindow != null)
             {
                 activeWindow.pushUndoState(mouseUndoPosition);
             }
             mouseUndoPosition = null;
         }
     });
 }
Example #3
0
        void processInputEvents(EventLayer eventLayer)
        {
            if (currentGesture == Gesture.None)
            {
                SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
                if (activeWindow != null && eventLayer.EventProcessingAllowed)
                {
                    CameraMover cameraMover = activeWindow.CameraMover;
                    if (cameraMover.AllowManualMovement)
                    {
                        IntVector3 mouseCoords = eventLayer.Mouse.AbsolutePosition;

                        if (MoveCamera.FirstFrameDown)
                        {
                            eventLayer.makeFocusLayer();
                            currentlyInMotion = true;
                            eventLayer.alertEventsHandled();
                            if (mouseUndoPosition == null)
                            {
                                mouseUndoPosition = activeWindow.createCameraPosition();
                            }
                        }
                        else if (MoveCamera.FirstFrameUp)
                        {
                            eventLayer.clearFocusLayer();
                            currentlyInMotion = false;

                            if (mouseUndoPosition != null)
                            {
                                activeWindow.pushUndoState(mouseUndoPosition);
                                mouseUndoPosition = null;
                            }
                        }
                        mouseCoords = eventLayer.Mouse.RelativePosition;
                        if (currentlyInMotion)
                        {
                            int x = mouseCoords.x;
                            int y = mouseCoords.y;
                            switch (movementMode)
                            {
                            case CameraMovementMode.Rotate:
                                if (cameraMover.AllowRotation)
                                {
                                    travelTracker.traveled(mouseCoords);
                                    if (LockX.Down)
                                    {
                                        x = 0;
                                    }
                                    if (LockY.Down)
                                    {
                                        y = 0;
                                    }
                                    cameraMover.rotateFromMotion(x, y);
                                    eventLayer.alertEventsHandled();
                                }
                                break;

                            case CameraMovementMode.Pan:
                                travelTracker.traveled(mouseCoords);
                                if (LockX.Down)
                                {
                                    x = 0;
                                }
                                if (LockY.Down)
                                {
                                    y = 0;
                                }
                                cameraMover.panFromMotion(x, y, eventLayer.Mouse.AreaWidth, eventLayer.Mouse.AreaHeight);
                                eventLayer.alertEventsHandled();
                                break;

                            case CameraMovementMode.Zoom:
                                if (cameraMover.AllowZoom)
                                {
                                    travelTracker.traveled(mouseCoords);
                                    cameraMover.zoomFromMotion(mouseCoords.y);
                                    eventLayer.alertEventsHandled();
                                }
                                break;
                            }
                        }
                        if (cameraMover.AllowZoom)
                        {
                            if (ZoomInCamera.Down)
                            {
                                if (mouseUndoPosition == null)
                                {
                                    mouseUndoPosition = activeWindow.createCameraPosition();
                                }
                                mouseWheelTimer.Stop();
                                mouseWheelTimer.Start();
                                cameraMover.incrementZoom(-1);
                                eventLayer.alertEventsHandled();
                            }
                            else if (ZoomOutCamera.Down)
                            {
                                if (mouseUndoPosition == null)
                                {
                                    mouseUndoPosition = activeWindow.createCameraPosition();
                                }
                                mouseWheelTimer.Stop();
                                mouseWheelTimer.Start();
                                cameraMover.incrementZoom(1);
                                eventLayer.alertEventsHandled();
                            }
                        }
                    }
                }
            }
        }