Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propogating molecule id in svg to the corresponding title element #980

Merged
merged 1 commit into from Jun 23, 2023

Conversation

parit
Copy link

@parit parit commented Jun 22, 2023

While drawing a reaction from a smiles string, we can set the depiction generator to add titles for each participant. The resulting svg generated has id attribute on each participant for ex: "mol1", by default on the first reactant. The corresponding title <g> has no correspondence with the molecule mol1. Therefore using javascript it is impossible to find out which title corresponds to which molecule in the svg. This is important if we need to fetch the metadata for the molecule (from a third service) when someone hover's over it's title.
As way around would be to propagate the id attribute on the molecule as a class name in the title. This patch does this. Please feel free to review.

Following this would be to allow data-* attributes on each molecule to add metadata in the resulting svg but that would be a different pull request.

@johnmay johnmay merged commit 855b3ae into cdk:main Jun 23, 2023
3 of 4 checks passed
@johnmay
Copy link
Member

johnmay commented Jun 23, 2023

Thanks all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants