Panning

8 posts, 0 answers
  1. Peter
    Peter avatar
    28 posts
    Member since:
    Oct 2006

    Posted 04 Apr 2012 Link to this post

    Hey,

    I'm using the Diagrams Framework in a project. I thought it would be nice to have a way of panning without the need of zoom. In your demos the IsPanEnabled is set but there is no way to pan around. I known that if you zoom the position of your cursor is used to pan but having some kind of hand-cursor to move the whole diagram around would be a pleasure. Have I missed a possibility to achieve this in the current version or are there any plans to include such a thing in a future version?

    Best Regards,
    Peter Schmidt
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 04 Apr 2012 Link to this post

    Hi Peter,

     By the default, the Panning feature is turned on. You can disable this functionality by setting the RadDiagram.IsPanEnabled property to False. Once the panning is enabled, you can press Ctrl + MouseLeftButton and start panning the RadDiagram. Read the help here.
    You can also change the current mouse tool to hand (pan) tool easily - read more
    Please let us know if you have further questions. 

    All the best,
    Miro Miroslavov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Peter
    Peter avatar
    28 posts
    Member since:
    Oct 2006

    Posted 04 Apr 2012 Link to this post

    Hi Miro,

    thanks! I did not know that. The shortcut is not standard so I did not try this combination. There is still a problem with this but therefore I need to describe the scenario:

    I am using Image Elements in Diagram to display a zooming background. So a great portion of the canvas is filled with DiagramShapes. The panning tool is only working on areas without any shapes underneath it. For an editing scenario this makes perfect sense. But I am using Diagram to display plans and the whole control is readonly. So it would be great if I could pan while hovering over shapes, too.

    Kind Regards,
    Peter Schmidt
  4. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 04 Apr 2012 Link to this post

    Hi Peter,

     If your shapes are 100% readonly, you can set the IsEnabled prop. to False, which will prevent the Hit Test service and so the panning will work everywhere. 
    Also note that you can change the short keys for the panning (if CTRL is not ok for you). 
    On a side note, we're considering to implement Scrolling option - you can vote and check the backlog item here.

    All the best,
    Miro Miroslavov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Lupe
    Lupe avatar
    2 posts
    Member since:
    Feb 2015

    Posted 12 Apr in reply to Miro Miroslavov Link to this post

    Hi,  How to change the default Ctrl+MouseLeftButton panning to just Mouse Left button down and drag?

    Thanks,

  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2992 posts

    Posted 13 Apr Link to this post

    Hi Lupe,

    This will happen if you set ActiveTool property to PanTool. Is this an option or you need a mixed mode - clicking on shape to move the shape, clicking on empty space on diagram to start pan tool ?

    Regards,
    Petar Mladenov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  7. Lupe
    Lupe avatar
    2 posts
    Member since:
    Feb 2015

    Posted 17 Apr in reply to Petar Mladenov Link to this post

    Hi Petar,

    Looking for the mixed mode. is there a way to set it?

    Thanks.

  8. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2992 posts

    Posted 18 Apr Link to this post

    Hello Lupe,

    You can develop custom Pointer Tool class which extends the one that is built-in and default in RadDiagram. Please find a sample code below:

    public class CustomPointerTool : PointerTool
       {
           public override bool MouseDown(PointerArgs e)
           {
               bool result = base.MouseDown(e);
     
               if (this.HitItem == null)
               {
                   this.ToolService.ActivateTool(PanningTool.ToolName);
                   return false;
               }
     
               return result;
     
           }
     
           public override bool MouseUp(PointerArgs e)
           {
               bool result = base.MouseUp(e);
     
               if ((this.Graph as RadDiagram).ActiveTool == MouseTool.PanTool)
               {
                   (this.Graph as RadDiagram).ActiveTool = MouseTool.PointerTool;
               }
     
               return result;
           }
       }
    public Example()
          {
              InitializeComponent();
              ToolService toolService = this.xDiagram.ServiceLocator.GetService<IToolService>() as ToolService;
              if (toolService != null)
              {
                  toolService.ToolList[0] = new CustomPointerTool();

    For more information regarding tools customization in RadDiagram you can take a look at:

    Diagram Tools Customization
    Diagram Custom Tools SDK
    Diagram Custom Connector Tools SDK

    Regards,
    Petar Mladenov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top