partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
247 stars 61 forks source link

Multiple Objects in Chemviewer From Editor #300

Closed cleblond closed 1 year ago

cleblond commented 1 year ago

I have a chemviewer that can be edited. I've set the editor/composer to allow more than one object to be drawn with the following.

chemViewer.setEditorProperties({'allowCreateNewChild': true});

However when I click OK in the editor the structure is not shown.

Is it not possible to draw reactions with reagents, arrows and products in the editor and have them displayed in the chemviewer?

Thank you. Carl LeBlond

partridgejiang commented 1 year ago

Hi @cleblond, you just need to set restrainEditorWithCurrObj property of viewer to false, which ensures not only the modifications to the original molecule but also other new added objects should be displayed in viewer:

chemViewer.setRestrainEditorWithCurrObj(false);
// chemViewer.setEditorProperties({'allowCreateNewChild': true});  // no more need to set this  
cleblond commented 1 year ago

Awesome thank you!