How to check and produce an action when marvinJS is cleared

User a0a0b9fc1b

27-05-2016 12:48:31

Hi,


I am embedding marvinJS
16.4.18 in a website linked with a webservice.


I was able to check any
change in the structure to produce an action by using
marvinSketcherInstance.on("molchange", function() { // do something
in JavaScript

});


Now I am struggling to check
when the sketcher is cleared to then produce another
action in JavaScript.


By clearing I mean either through the upper left button or by selecting
and deleting, in fact by any mean that would display the "phenyl/hand” icon, the “Marvin
JS” and the “Chemaxon” icon as in the initial state (when the page is loaded).


Is there a way to check
that the sketcher is in this "cleared" state?


Thanks a lot in advance for your help.


My best,


Antoine.

ChemAxon 76c88f5366

31-05-2016 13:55:26

Hi Antoine, 


I think, you are looking for the isEmty() function. This returns true when the canvas is empty.
For more information, please check the API documentation: https://marvinjs-demo.chemaxon.com/latest/jsdoc.html


I hope this will help.


Best regards,
Eszter 

User a0a0b9fc1b

10-06-2016 16:27:48

Cheers Eszter,


Thanks to your replay I kept at trying it with the isEmpty() function and it finally worked.


Best,


Antoine.