Canguro.Controller.Controller.scenePanel_MouseDown C# (CSharp) Method

scenePanel_MouseDown() private method

Method to dispatch the MouseDown event from the ScenePanel and forward it to the current ViewCommand. It is responsible for capturing the mouse.
private scenePanel_MouseDown ( object sender, System e ) : void
sender object
e System
return void
        void scenePanel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            System.Diagnostics.Debug.Assert(mainFrm != null);
            mainFrm.ScenePanel.Focus();
            GraphicViewManager.Instance.SetActiveViewFromPoint(e.X, e.Y);

            if (e.Button == MouseButtons.Middle)
            {
                lastViewCmd = viewCmd;

                if (Control.ModifierKeys == Keys.Control)
                    Execute("rotate");
                else
                    Execute("pan");
            }

            if (viewCmd != null)
            {
                if (viewCmd != SelectionCommand)
                    mainFrm.ScenePanel.Capture = true;

                // If animating, don't allow Selection
                if (viewCmd != SelectionCommand || !GraphicViewManager.Instance.ActiveView.ModelRenderer.RenderOptions.ShowAnimated)
                {
                    viewCmd.ButtonDown(GraphicViewManager.Instance.ActiveView, e);
                    mainFrm.ScenePanel.Cursor = viewCmd.Cursor;
                }
            }
        }