Automatically layout BPMN diagram on import

Is there any way to place all connection elements at appropriate position automatically,when importing "bpmn-js diagram?

1 Like

You would like your diagrams to be automatically laid out on open? Why is that? Does the diagram not contain graphical information yet?

It has graphical information but it has untidy connections. Every connection has only two (start and end) way-points.

When we move an element, bpmnjs tries to improve the way other elements connect to that element (by changing its connection’s way-points after we drop the element I guess).

Is there any way we can do that on all connections? (for example after loading)

We already do something something similar to fix broken element dockings in the ImportDockingFix behavior.

You could write a similar behavior and use our existing layout facilities (BpmnLayouter#layoutConnection) to correct the waypoints of imported connections.