Element ordering on viewer initialization

Hello,

I’ve been breaking my head over the following issue the past few days. Our company uses the BPMN viewer to display diagrams. We show some labels, colors and tooltips to show contextual information and actions. One of these features is a colored path to show the history of the process. Currently we use markers and css coloring for this.
Works fine until you have 2 sequence flows drawn on top of eachother. which happens a lot after and before gateways. In this case we want the colored flow to be drawn on top of course.

Doing some research, the orderingProvider seemed the way to go. After a lot of frustration and tinkering I found that this is not called in the viewer as it is only triggered on the ‘move’ and ‘create’ events. Switching to a stripped down modeler also didn’t work as ‘create’ seems to be called on creating a new element and not when the diagram is first drawn.

As far as I can see, when the diagram is initiated it is drawn in the order of which the elements are being pulled from the xml importer?
So my question is, how can I redraw the diagram with a custom order (like with the ordering provider), preferably in the viewer and not the modeler, without having to move or create an item first.

I cant seem to figure out where in the lifecycle I can call this or what function or module to extend to achieve this.

Thank you

Diagram importing (and ordering upon importing) is not supported and won’t likely be.

If you’d like to highlight the path a flow took, why not simply render on top of the existing diagram? Think about something like this here (screenshot taken from nikku/camunda-playground):

It is fairly straight forward to query diagram elements by ID, get their waypoints and render something on top of the given diagram.