How to zoom and pan in React Diagram with various ways?
In Syncfusion® React Diagram
Zoom using zoomTo method:
The
//To zoomIn
document.getElementById('zoomIn').onclick = () => {
let zoomin = { type: 'ZoomIn', zoomFactor: 0.2 };
diagram.zoomTo(zoomin);
diagram.dataBind();
};
//To zoomOut
document.getElementById('zoomOut').onclick = () => {
let zoomout = { type: 'ZoomOut', zoomFactor: 0.2 };
diagram.zoomTo(zoomout);
diagram.dataBind();
}
Zoom using mouse wheel:
Zooming using Keyboard Shortcuts:
Pan using diagram tool:
document.getElementById('zoomPan').onclick = () => {
diagram.tool = ej.diagrams.DiagramTools.ZoomPan;
diagram.dataBind();
};
Zooming and Panning using Touch Gestures:
-
Use a pinching motion with your thumb and forefinger to zoom in (pinching inward) or zoom out (pinching outward). -
Pan by swiping with one finger.
Zooming and Panning using Overview panel:
In the overview panel, the red box indicates the region of the page that is shown in the drawing window. If you do not see a red box, drag to create a red box. The red box indicates the region of the page that is shown in the drawing window.
-
Resize the red box by dragging a side until it fits the area that you want to magnify.
-
To view other sections of the diagram (or to “pan” the diagram), click inside the red box and drag it over the section you want to view.
Sample:
Conclusion
You can refer to our React Diagram
For current customers, you can check out our components from the
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!