Ejemplo n.º 1
0
        private void OnControlsUpdate(PreviewControls controls)
        {
            switch (controls)
            {
            case PreviewControls.Creation:
                if (!(this.ControlsContent is PreviewCreationControls))
                {
                    this.ControlsContent = new PreviewCreationControls();
                }

                break;

            case PreviewControls.Generation:
                if (!(this.ControlsContent is PreviewGeneratingControls))
                {
                    this.ControlsContent = new PreviewGeneratingControls();
                }

                break;

            case PreviewControls.Playback:
                if (!(this.ControlsContent is PreviewPlaybackControls))
                {
                    this.ControlsContent = new PreviewPlaybackControls();
                }

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(controls), controls, null);
            }
        }
Ejemplo n.º 2
0
 public void Initialize(GraphicsDeviceControl graphicsDeviceControl, PreviewControls previewControls)
 {
     mPreviewControls = previewControls;
     mPreviewControls.OnionSkinVisibleChange += new EventHandler(HandleOnionSkinChange);
     mPreviewControls.SpriteAlignmentChange  += new EventHandler(HandleSpriteAlignmentChange);
     mControl             = graphicsDeviceControl;
     mControl.XnaDraw    += new Action(HandleXnaDraw);
     mControl.MouseWheel += new System.Windows.Forms.MouseEventHandler(HandleMouseWheel);
     HandleXnaInitialize();
 }
Ejemplo n.º 3
0
        public void HandleMouseWheel(Cursor cursor, int change, PreviewControls previewControls)
        {
            float worldX = cursor.GetWorldX(Managers);
            float worldY = cursor.GetWorldY(Managers);

            float oldCameraX = Camera.X;
            float oldCameraY = Camera.Y;


            float oldZoom = ZoomValue / 100.0f;

            if (change > 0)
            {
                previewControls.ZoomIn();
            }
            else
            {
                previewControls.ZoomOut();
            }

            ImageRegionSelectionControl.AdjustCameraPositionAfterZoom(worldX, worldY,
                                                                      oldCameraX, oldCameraY, oldZoom, ZoomValue, Camera);
        }