How to Update Orthogonal Segments in Vue Diagram Connectors?
This article explains how to update orthogonal segments in Vue Diagram connectors. To update orthogonal segments when a connector is drawn dynamically from one port to another, you can utilize the CollectionChange event. When a connector is added or removed, the Vue Diagram connector collection is modified, which triggers the CollectionChange event. This event is triggered twice during the process—once in the “changing” state and again in the “changed” state once the action has been completed.
Below is a code example demonstrating how to update orthogonal segments when dynamically drawing a connectors:
We can draw the connector from the port by enabling draw constraints on the port.
// Enable draw constraints
constraints: PortConstraints.Default | PortConstraints.Draw,
When a connector is drawn from a port, the event is triggered and updates the segments of an orthogonal connector when the connector’s state changes to ‘Changed’.
collectionChange: (args) => {
if (args.state === 'Changed' && args.element.type == 'Orthogonal') {
let connector = args.element;
connector.segments = [
{
type: 'Orthogonal',
direction: 'Right',
length: 70,
},
];
}
},
Refer to the working sample for additional details and implementation: Sample
Conclusion
We hope you enjoyed learning how to update orthogonal segments in Vue Diagram connectors.
You can refer to our Vue Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our Vue 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!