GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoToolPanning Class
In This Topic
    GoToolPanning Class
    In This Topic
    This tool supports both automatic and manual panning in a view.
    public class GoToolPanning : GoTool, IGoTool  
    When autopanning, this remembers an initial panning point and then autoscrolls the view in the direction of the current mouse point relative to the original panning point. This tool can be used in either a modal or a mode-less manner. To use modally, where the first mouse click will establish the panning origin, mouse moves determine autopanning direction and speed, and the second mouse up will stop the tool:
                  aView.Tool = new GoToolPanning(aView);
    If you set the Origin before the tool starts, the first mouse click is not needed.
                  GoToolPanning tool = new GoToolPanning(aView);
                  tool.Origin = aView.LastInput.ViewPoint;  // or another point in the view
                  aView.Tool = tool;

    It is started mode-lessly when the user presses the middle mouse button, which is normally the mouse wheel. An instance of this tool is in the GoView.MouseDownTools list.

    For manual panning, you will need to create a separate instance of this class and set AutoPan to false. Then the user's left-mouse down and drag and up will pan the view. When you set the Modal property, this tool will remain in this mode even after the user does a mouse up. They can cancel this mode by pressing the Cancel key.

    By default no manual-panning tool is installed in a GoView. To implement a "Manual Pan" command:

                GoToolPanning panningtool = new GoToolPanning(myView);
                panningtool.AutoPan = false;
                panningtool.Modal = true;
                myView.Tool = panningtool;
    However, if you do not need the user to do multiple selections by using the GoToolRubberBanding tool, you may find it nicer to use the manual panning tool in a mode-less manner, so that the user can use all the other standard tools in a natural fashion.
                GoToolPanning panningtool = new GoToolPanning(myView);
                panningtool.AutoPan = false;
    Both GoToolRubberBanding and this GoToolPanning (when AutoPan is false) are started when the user does a mouse-down and drag in the background, so those two tools would conflict. But the user can still do multiple selections by using Shift- or Control-click.

    However, in ASP.NET WebForms, the panning gesture consists of only a single mouse-down, drag, mouse-up. Since mouse moves are only simulated on WebForms, and auto-panning is not possible with no mouse time information and no immediate feedback, a simpler gesture is easier to use. This results in just a single scroll, according to the distance and direction between the FirstInput.ViewPoint and LastInput.ViewPoint.

    So for WebForms, the default (modeless) panning tool that is installed as a GoView.MouseDownTools is not an auto-panning tool but a manual one: AutoPan is false. It uses the middle mouse button instead of the left mouse button. Only when Modal is true, so that the user is in a special "panning mode", does the left mouse button start and perform the pan. If you want to let the user pan the GoDiagram Web view with the left mouse button in a modeless fashion, rather than with the middle mouse button, remove the rubberband selection tool: goView1.ReplaceMouseTool(typeof(GoToolRubberBanding), null);

    See Also