Gestures in Diagram

2 posts, 0 answers
  1. Mike
    Mike avatar
    16 posts
    Member since:
    Mar 2018

    Posted 13 Nov Link to this post

    Hello,

    I have a RadDiagram in a winform that displays an image (RadDiagramShape) with a box (RadDiagramShape) over it.  A third RadDiagramShape is used to display the region of the first image that the box is over.  Mouse events to control dragging and mouse scroll to make the box larger/smaller so that the user can move around the image and zoom in/out.  Similarly, the third shape has events for dragging and mouse scroll which controls the box as well.

    I am trying to enable similar functionality with touch gestures, but am having some difficulties.  I can only seem to enable gestures for the diagram itself, but not for the RadDiagramShapes within it.  When I allow zoom gestures on the RadDiagram, it zooms the RadDiagram even though IsZoomEnabled = false.  This seems to prevent the zoom for the mouse controls, but not for the gestures.  It also moves the diagram around in some cases, although I can't seem to figure out what is moving as the position isn't changing.  Pan and Drag are not enabled.

    I do not want to zoom into or move the RadDiagram.  I want to catch the gesture, and control the size of the box so that the user can zoom in/out as they do with the mouse controls.

    In order to do this, I would have to cancel the event and manually process, but I can't seem to figure out a way to do this.

    Any ideas?

    Thanks

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3469 posts

    Posted 14 Nov Link to this post

    Hello, Mike,

    All gestures are defined at control level. Hence, if you need to customize the default logic somehow or just disable a certain gesture, you can create a derivative of RadDiagram and override its OnGesture method. Then, considering the GestureType, you can decide how to proceed further, either call the basic logic or skip it and perform your own: 
            public class CustomDiagram : Telerik.WinControls.UI.RadDiagram
            {
                protected override void OnGesture(GestureEventArgs args)
                {
                    if (args.GestureType == GestureType.Zoom)
                    {
                        return;
                    }
                    Console.WriteLine(args.GestureType);
                    base.OnGesture(args);
                }
            }

    Additional information about the touch support is available in the following help article: https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/touch-support  

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top