Hi.

How can I get the x & y coordinates of a link between two nodes?

Scenario: I am trying to position a link label. I need to compute the segmentfraction for based on a specific horizontal offset from the from-node. For example, say I want the topleft of the label to be exactly 20 pixels from the right edge of the node (the links always come from the right of the node in this case), then because the link can be at an angle I have to calculate the fraction of the link length required to have the label positioned exactly 20 **horizontally** pixels away from the node etc.

If I can get the co-ordinates of the from- and to- ends of the link I can carry out the calculations.

So - how to get the co-ordinates of the ends of a link please ?

PS. I am aware that if I use a bezier link style then this will make the calculation much more difficult. My links are default straight lines, although I do use the toShortLength attribute and I have yet to decide what impact this will have.

I have a feeling that this should be easy but at the moment I can’t think of the way forward.

Thanks in advance.