|
I am creating a diagram (nodes/connectors/annotations) programmatically (through .ts) and want to be able to center those nodes inside the diagram bounds. As I don't know how many nodes ahead of time, this would need to happen at run time. Is there a way to make all the added nodes fit within the bounds of the diagram (which is also dynamic in the sense that it has a percentage width rather than a hard coded pixel value). |
By using the scroll settings we can able to get the diagram viewport width. So by using view port width we can set offsetx for the node. So it looks like node gets renders in the center of the diagram bounds.
| |
|
Along with the above, is there a way to center/zoom to a selected node?
|
By default, in the diagram we can able to zoom in or zoom out the diagram. We does not able to zoom the particular node in diagram. Please find the below code snippet for how to zoom in or zoom out the diagram.
| |
|
And finally, how to select a node programmatically?
|
By using diagram public API method select we can able to select a particular node in the diagram programmatically.
|