Skip to main content

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!

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


Reply