partridgejiang / Kekule.js

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

Setting default tool. #175

Open cleblond opened 4 years ago

cleblond commented 4 years ago

Having difficulty setting the default tool to ElectronPushingArrowDouble. The following indicates action is undefined. Also I noticed that selecting this way doesn't enable the tool button. Is that as designed. Thanks.

var action = composer.getActionMap().get(composer.getCompActionClass('repElectronPushingArrowDouble')); action.execute();

partridgejiang commented 4 years ago

Hi @cleblond, usually the parent action of action 'repElectronPushingArrowDouble' should be executed together to make child action checked in the toolbar. In the latest dist, a shortcut method execBoundEditorAction can be used here:

composer.execBoundEditorAction('glyph');   // execute the parent action in default settings of composer
var childAction = composer.execBoundEditorAction('repElectronPushingArrowDouble');  // then the arrow action