rdkit-js icon indicating copy to clipboard operation
rdkit-js copied to clipboard

Attach click event handler to hidden carbones

Open ben-ikt opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Hello, I want select atoms by clicking on them. I listen to the click events on atoms. With the css class, I could identify atom but hidden carbones aren't displayed. So I can't attach a click event handler.

Capture d’écran 2022-11-24 à 13 33 04

Describe the solution you'd like

You could display hidden carbones with a transparent . In this case, I could attach a click event handler and create interactivity.

if atom-0 is a hidden carbon I expected a svg like this:

<ellipse class="atom-0 hidden" />
<path class="bond-0 atom-0 atom-1" />
<ellipse class="atom-1" />

instead of:

<path class="bond-0 atom-0 atom-1" />
<ellipse class="atom-1" />

Describe alternatives you've considered I need to attach the click event to the bond (svg and analyse if the user is close to the hidden carbon to trigger an event like clicking on the ellipsis would.

Thanks

ben-ikt avatar Nov 24 '22 12:11 ben-ikt

cc @ptosco , any suggestions here?

MichelML avatar Nov 24 '22 16:11 MichelML

Hi everyone, I think it's a hidden hydrogen instead of a hidden carbon.

ben-ikt avatar Dec 02 '22 14:12 ben-ikt

I think it's a carbon actually, hidden hydrogens are not plotted at all (not even as unmarked ends of bonds).

The requested feature is actually quite useful. Is there any plan to include it in a future release?

najwalb avatar Oct 19 '23 15:10 najwalb