partridgejiang / Kekule.js

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

Setting composer config from chemviewer #88

Open cleblond opened 5 years ago

cleblond commented 5 years ago

Is there anyway to set the composer config when the composer is loaded from the viewer (loadEditor button). For example I'd like to set "Element specified colors=true" as the default when the composer is opened from a viewer.

partridgejiang commented 5 years ago

Yes, you can use the editorProperties property of Viewer to set the property values of composer associated with the Viewer before opening it. For example, the following codes create a specified render configs to draw the molecule atoms with their own colors in composer:

var renderConfigs = new Kekule.Render.Render2DConfigs();
renderConfigs.getColorConfigs().setUseAtomSpecifiedColor(true);
chemViewer.setEditorProperties({'renderConfigs': renderConfigs});
cleblond commented 5 years ago

Thanks!