jsme-editor / jsme-editor.github.io

73 stars 19 forks source link

Templates attach at wrong atom #20

Closed smpaley closed 1 year ago

smpaley commented 2 years ago

I'm trying to use the template functionality, and it doesn't seem to be working correctly. When I try to add a template to an existing structure, the attachment very often happens at the wrong atom in the template. When this happens, further attempts to add a template result in a javascript error. I can replicate this very easily using your example page https://jsme-editor.github.io/dist/JSME_parent_and_metabolites.html. I created a simple molecule with an O at one end, and then clicked the phosphate button to add a phosphate group. Looking at the source code, the JME for the template clearly specifies the P atom as the attachment site, but the software attaches at an O atom instead. If I click somewhere else to try to add another phosphate group, I get a javascript error. I've added a screenshot showing both the resulting structure and the javascript error, but the problem is very easy to reproduce and not limited to this example, making the template functionality useless.

Screen Shot 2022-01-24 at 11 53 05 AM