Skip to main content
Jun 4, 2025 7:04 AM UTC
Solved

Changing the endpoints of a line

Hello,

In my extension I use hookSelection() method for deleting unwanted lines between Custom Shapes. And it works good when I create a new line. But I faced a problem when I change endpoints of the existing line.

Lets say there is a line between shape A and shape B. Shape A can only be connected with shape B, and it can be only as upstream connection for the line, otherwise it should be deleted(removed from the page). When I move line endpoint from the shape B to some other shapes, the line is not removed. But when I unfocus the line and focus it again, it gets deleted.

Is there any ideas or tips on how to make an existing line be removed from a page specifically when its endpoints change?

Thanks in advance!

Humas1985
Humas1985Answer
Lucid Legend Level 10
Jul 20, 2025 11:54 AM UTC

Hi ​@Darina Kasimova 

Changing a line’s endpoints in Lucidchart does not always trigger an event that extensions can immediately detect so logic like auto-deleting invalid connections may only run once focus changes or after a related event. This is a known limitation.

To delegate, you can try registerShapeEvent(SHAPE_UPDATED) to listen for shape or line property updates and validate connections in real time. However, results may vary based on the extension's structure, so you may need to implement a periodic check or polling if updates are not consistently captured.

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Huma || Lucid Legend

Comments

Humas1985
Lucid Legend Level 10
Humas1985Lucid Legend Level 10Answer
Lucid Legend Level 10
Jul 20, 2025 11:54 AM UTC

Hi ​@Darina Kasimova 

Changing a line’s endpoints in Lucidchart does not always trigger an event that extensions can immediately detect so logic like auto-deleting invalid connections may only run once focus changes or after a related event. This is a known limitation.

To delegate, you can try registerShapeEvent(SHAPE_UPDATED) to listen for shape or line property updates and validate connections in real time. However, results may vary based on the extension's structure, so you may need to implement a periodic check or polling if updates are not consistently captured.

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Translate
Huma || Lucid Legend