Marvin for JavaScript Examples - Manage selection

Atoms:

Bonds:

This example demonstrates how to control selection via JavaScript API. The Get selection retrieves the list of selected atoms and bonds from the editor and displays it in the above form.

You can edit both the atom list and bond list in the form.

Atoms can be referred to by their atom index. A bond can be described with the atom index of its nodes.

With the Set selection button, you can update selection in the editor. Those atoms and bonds will be selected that are enumerated on the selection form.