- Home
- Forum
- Angular - EJ 2
- How to apply zooming and paning feature on diagram?
How to apply zooming and paning feature on diagram?
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.
SIGN IN To post a reply.
3 Replies
RT
Ramya Thirugnanam
Syncfusion Team
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;
|
Help documentation: https://ej2.syncfusion.com/angular/documentation/diagram/tools/?no-cache=1#tool-selection
Regards,
Ramya T
SK
Siddharth Kulat
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
RT
Ramya Thirugnanam
Syncfusion Team
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();
}
|
Help documentation link: https://help.syncfusion.com/js/diagram/commands#zoom
Regards,
Ramya T
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
SK Siddharth Kulat
- Jul 1, 2019 03:07 PM UTC
- Jul 2, 2019 11:58 AM UTC