Skip to content

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

Merged
johnmay merged 1 commit intocdk:mainfrom
parit:molToTitle
Jun 23, 2023
Merged

Propogating molecule id in svg to the corresponding title element #980
johnmay merged 1 commit intocdk:mainfrom
parit:molToTitle

Conversation

@parit
Copy link
Copy Markdown

@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
@johnmay
Copy link
Copy Markdown
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.

2 participants