How to restrict the elements/ objects in positive side of the Diagram.
This article explains how to restrict the elements or objects on the positive side of the Diagram.
In the diagram, you can restrict the diagram element to the positive side of the diagram by using the boundaryConstraints feature in the pageSettings. The default value of the boundaryConstraints is “Infinity,” which allows dragging everywhere in the diagram.
To restrict the diagram element to the positive side of the diagram, set the boundary constraints to "Page" in the pageSettings, and set the width and height of the pageSettings to ensure the positive side of the diagram. The diagram elements are only draggable within the given bounds based on the defined width and height of the diagram’s pageSettings
let diagram: Diagram = new Diagram({
width: '100%', height: '700px',
// set the boundaryConstraints to “Page” and need to set width and height
pageSettings:{
boundaryConstraints: "Page",
width:1800,
height:800}
});In the above example, the diagram nodes or connectors are available to drag only on the positive side of the diagram. The width is 1800, and the height is 800, and one cannot drag the diagram object beyond the page.
Refer to the working sample for additional details and implementation: Sample
To restrict the diagram element on the positive side of the diagram, set the boundary constraints to "Diagram" in the pageSettings, and the diagram elements are only draggable in the viewport area.
let diagram: Diagram = new Diagram({
width: '100%', height: '700px',
// set the boundaryConstraints to “Diagram”
pageSettings:{
boundaryConstraints: "Diagram"}
});Refer to the working sample for additional details and implementation: Sample
Conclusion
We hope you enjoyed learning about how to restrict the elements/ objects on the positive side of the Diagram.
You can refer to our JavaScript Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums,BoldDesk Support, or feedback portal. We are always happy to assist you