HTML element or HTML id of the DOM element where the viewer will be created
list of properties keys to be used as options
callback called when a new atom is clicked on
Callback to get the initial positioning of the settings modal.
The callback is called once, the first time the settings are opened.
list of atom-centered environments for the current structure
Applies saved settings, possibly filling in with default values
Highlight a given atom
in the current structure.
If a supercell larger than [1, 1, 1] is currently displayed, this
function accept indexes larger than the result of natoms()
, and will
then highlight atoms outside of the central image.
Optional
center: numberindex of the central atom in the environment to show,
or undefined
to disable highlighting.
Load the given structure
in this viewer.
structure to load
Optional
properties: Record<string, (undefined | number)[]>properties to used to load the structure
options for the new structure
Optional
onLoadingDone: (() => void)fired when viewer finished rendering
Add the given callback
to be called whenever a setting changes. The
callback will be given the path to the settings as a list of keys; and
the new value of the setting.
There is currently no way to remove a callback.
Remove all HTML added by this MoleculeViewer in the current document
Save the values of the current settings in a way that an be used with applySettings or saved to JSON.
Create a new
MoleculeViewer
inside the HTML DOM element with the givenid
.