Link Layer ends with different layers

I maintain the link layer with the linkLayer attribute.
As soon as a group is collapsed i “send” all links to “Background”.
When a group is expanded i “sends” the link “Foreground”,
Yet if the link is interconnected to another group, i would like to maintain the link layer “background” at the collapsed group.
In the attached pic, the link is sent to “Foreground”, so both ends are in front. I need to maintain the “right” end, on the collapsed group, at “background”
Any ideas ?

Clearly a binary choice of “Background” or “Foreground” is not precise enough for your needs. I think you’ll need to put everything in the same Layer (might as well be the default layer, named “”), and control the Part.zOrder yourself for all nodes and links.

You told me not to use zOrder but i believe there is no other choice.
Still, if i use zOrder, how do i send one end of the link to back and maintain the other end in front ?

I don’t remember saying that, but it must have been when I didn’t understand your requirements.

By having one node be in front of the link and the other node behind the link, you can achieve want you want for that link.

I hope you can get what you want for all links by imposing a total z-ordering on all the nodes and links.