Skip to main content
Answer

About line.getDownstreamConnection() endpoints

  • November 4, 2024
  • 5 replies
  • 101 views

Forum|alt.badge.img+4

Hello,

This function line.getDownstreamConnection() doesn’t follow line arrow state when a line arrow direction get changed by “swap line ending” or change line arrow style.

 

As far as I understand it (according to this article and screenshot attached below as well), the first and second endpoints are in context of the arrow direction is that true? otherwise, how to get the arrow direction of a line(that applies to multi-directional lines as well)?

 

 

Best answer by Nathan Kim

Hello KGV,

Yes, you are right. Unfortunately, getDownstreamConnection() does not account for changing the arrow direction or style. Instead, it returns the shape that the line was originally drawn to. This behavior is similar to the DOWNSTREAM shape reference formula, here.

To work around this, you can get the arrowhead style of an endpoint, using something like
lineProxy.getEndpoint2().style . For example, for a default arrow with an arrowhead on Endpoint 2, the result is Arrow. If there is no arrowhead (and so the arrow visually points from Endpoint 2 to Endpoint 1), the result is undefined .
Then, from where the arrowheads are, you can infer the visual direction of a line.

If you would like further help or clarification, we are happy to assist further.

-Nathan

Comments

Michael B
Forum|alt.badge.img+4
  • Lucid product team
  • November 4, 2024

Hello KGV,

I am investigating your question and will have a response soon.


Forum|alt.badge.img+4
  • Author
  • January 13, 2025

 ​Hello ​@Michael B 

Any updates about this ticket?


Michael B
Forum|alt.badge.img+4
  • Lucid product team
  • January 13, 2025

EEK!

I apologize for letting this slip KGV. I had an unexpected sudden leave of absence the day after this post and didn't properly hand it off. I am reviewing it now.


Nathan Kim
Forum|alt.badge.img+2
  • Lucid product team
  • Answer
  • January 14, 2025

Hello KGV,

Yes, you are right. Unfortunately, getDownstreamConnection() does not account for changing the arrow direction or style. Instead, it returns the shape that the line was originally drawn to. This behavior is similar to the DOWNSTREAM shape reference formula, here.

To work around this, you can get the arrowhead style of an endpoint, using something like
lineProxy.getEndpoint2().style . For example, for a default arrow with an arrowhead on Endpoint 2, the result is Arrow. If there is no arrowhead (and so the arrow visually points from Endpoint 2 to Endpoint 1), the result is undefined .
Then, from where the arrowheads are, you can infer the visual direction of a line.

If you would like further help or clarification, we are happy to assist further.

-Nathan


Forum|alt.badge.img+4
  • Author
  • January 17, 2025

Hello ​@Nathan Kim ,

Thanks for the answer, will try the proposed workaround.