Zoom/Pan/Rotate without pressing the mouse button

Requires Eyeshot 9.0.174 or greater.

Eyeshot normally supports Zoom/Pan/Rotation operation when a mouse button is pressed.

Using the following ViewportLayout-derived class it is possible to enable the Zoom/Pan/Rotate movements without pressing a mouse button, simply pressing some ModifierKeys combinations: 

internal class MyViewportLayout : devDept.Eyeshot.ViewportLayout
{

    protected override void OnKeyDown(KeyEventArgs e)
    {
        base.OnKeyDown(e);

        if (!Moving)
        {
            startZPR = true;
        }
    }

    protected override void OnKeyUp(KeyEventArgs e)
    {
        base.OnKeyUp(e);

        EndZoomPanRotate(Viewports[ActiveViewport]);
    }

    bool startZPR = false;

    protected override void OnMouseMove(MouseEventArgs e)
    {
        base.OnMouseMove(e);

        if (startZPR)
        {
            StartZoomPanRotate(e, Viewports[ActiveViewport]);
            startZPR = false;
        }
    }
}

 

Then define some keyboard modifiers combinations:

viewportLayout1.Rotate.MouseButton = new MouseButton(MouseButtons.None, modifierKeys.Ctrl);
viewportLayout1.Zoom.MouseButton   = new MouseButton(MouseButtons.None, modifierKeys.Shift);
viewportLayout1.Pan.MouseButton    = new MouseButton(MouseButtons.None, modifierKeys.CtrlShift);
Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

Comments

1 comment
  • Thanks for this trick!

    Please note that EndZoomPanRotate seems to change the current ActionMode of the viewport.

     

Please sign in to leave a comment.