Link selection after relinking

Hello, I’ve noticed that relinking a link adds it to the current diagram selection. However, I noticed that this selection does not trigger the “ChangedSelection” event. Is this intentional? Is there a way to change the selection behavior related to the RelinkingTool’s “reconnectLink”?

Actually, the user would not be able to reconnect an existing link unless the link was already selected and showing relinking handles. And relinking would not change the selection, which is why there’s no “ChangedSelection” DiagramEvent upon a relinking.

Thank you for the response! Sorry, I should’ve mentioned that the the relinking handles are set to show upon being highlighted as well (via updateAdornments). I forgot that this is not default behavior, and is set on our end.

Relinking an unselected link (which is only possible with this change) seems to add the link to the selection without triggering the “ChangedSelection” event. I see that the selection is updated on the “LinkRelinked” event (whatever was selected before + the reconnected link).

The default implementation of RelinkingTool.updateAdornments only shows relinking handles if the link is selected. Is your code selecting the link when it becomes highlighted?

The link isn’t selected when highlighted. Rather, we just attach “RelinkTo”/“RelinkFrom” adornments to the link when conditions are met (which includes highlighting) using part.addAdornment/part.removeAdornment. This seems to allow links to be Relinked while unselected (confirmed that link is not selected by checking its selection status in RelinkingTool.doActivate).

In the RelinkingTool, it seems selection happens between “doActivate” (originalLink is not selected) and “doDeactivate” (originalLink is selected).

OK, I see what you mean. This is a situation we hadn’t anticipated. I’m thinking that the RelinkingTool shouldn’t change the Link.isSelected status for the link being reconnected. What do you think about that policy? Or do you think the link should always be selected after the tool has operated?

Haha, sorry. I do understand that this might not be an easily anticipated use case!

I’m not sure what most people might want, but I think it makes sense to either 1) not select the link by default or 2) select the link, but also trigger the “ChangedSelection” event (and potentially let the user change it easily or have it as an option?).

OK, I think it’s cleanest if the RelinkingTool doesn’t change the selection. That will come out in the next release.

Thanks for reporting the inconsistency in this situation.

1 Like

Hi,

What’s the status of this change? I don’t see any references to this in the last couple release notes.

Thanks

It’s in 2.1.54. We’ll fix the changelog. Thanks for pointing out the missing entry.

1 Like