We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply zooming and paning feature on diagram?

Thread ID:

Created:

Updated:

Platform:

Replies:

145620 Jul 1,2019 03:07 PM UTC Jul 2,2019 11:58 AM UTC Angular - EJ 2 3
loading
Tags: Diagram
Siddharth Kulat
Asked On July 1, 2019 03:07 PM UTC

Hello,

We are creating some sample map using the Diagram feature in the angular. We want zoom and panning feature in the diagram. We have created diagram like below,

In the drawshape.component.html
<ejs-diagram #diagram id="diagram" width="100%" height="700px" [snapSettings]='snapSettings' [getConnectorDefaults]='connDefaults' [getNodeDefaults]='getNodeDefaults' dragEnter='dragEnter' (created)="diagramCreate($event)" [constraints]='diagramConstraints'> </ejs-diagram>

And in the drawshape.component.ts file,

ngOnInit(): void {
       this.diagramConstraints = DiagramConstraints.PageEditable | DiagramConstraints.Zoom & ~DiagramConstraints.Pan;
    },

What changes need to be done in the code? Please suggest. Thank you.



Ramya Thirugnanam [Syncfusion]
Replied On July 2, 2019 06:19 AM UTC

Hi Siddharth,  
 
Thanks for contacting Syncfusion support. 
 
Please set DiagramTools as ZoomPan to activate pan tool in diagram. Please refer to the below code example, sample and help documentation.  
 
Code example:  
App.component.html  
  <ejs-diagram #diagram id="diagram" width="100%" height="499px"  [tool]='tool' 
            </ejs-diagram>  
 
App.component.ts  
public tool: DiagramTools = DiagramTools.ZoomPan;  
 
 
 
 
 
Regards,  
Ramya T 


Siddharth Kulat
Replied On July 2, 2019 09:04 AM UTC

Hello Sir,

Thanks for the update. Actually we want the achieve the functionality using the button click. I am attaching the image of the required functionality. Do you have any sample code for that?

PFA,

Thank You

Ramya Thirugnanam [Syncfusion]
Replied On July 2, 2019 11:58 AM UTC

Hi Siddharth,  
 
We have modified a sample to activated pan tool in button click. Please refer to the code example and sample below.  
 
Code example:  
  
<div>   
  <button id="changeTool" (click)="changeTool()"> changeTool </button>  
</div>  
 
changeTool(): void {  
      //set ZoomPan tool  
       this.diagram.tool =  DiagramTools.ZoomPan;  
       this.diagram.dataBind();  
      
 
 
 
 
Regards, 
Ramya T 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon