new StateManager(glviewer, config)
$3Dmol.StateManager - StateManager creates the space to preserve the state of the ui and sync it with the GLViewer
Name | Type | Description |
---|---|---|
glviewer | $3Dmol. | StateManager is required to have interaction between glviewer and the ui. |
config | Object | Loads the user defined parameters to generate the ui and handle state |
- Source
Methods
addAtomLabel(labelValue, atom)
Adds atom label to the viewport
Name | Type | Description |
---|---|---|
labelValue | Object | Output object from propertyMenu form of Context Menu |
atom | AtomSpec | Atom spec that are to be added in the label |
- Source
addLabel(labelValue)
Adds Label to the viewport specific to the selection
Name | Type | Description |
---|---|---|
labelValue | Object | Output object from label form of Context Menu |
- Source
addModel(modelDesc)
Add model to the viewport
Name | Type | Description |
---|---|---|
modelDesc | Object | Model Toolbar output |
- Source
addSelection(spec, sid)
Add Selection from the ui to glviewer
Name | Type | Description |
---|---|---|
spec | Object | Object that contains the output from the form |
sid | String | If surface id being edited then sid is set to some string |
- Source
String
addStyle(spec, sid, stid)
Add style and renders it into the viewport
Name | Type | Description |
---|---|---|
spec | String | Output object of style form |
sid | String | Selection Id |
stid | String | Style Id |
- Source
String
addSurface(property, callback)
Adds surface to the viewport
Name | Type | Description |
---|---|---|
property | Object | Surface output object |
callback | function | callback |
- Source
String
checkAtoms(sel)
Return true if the selections contain at least one atom
Name | Type | Description |
---|---|---|
sel | AtomSelectionSpec | Atom selection spec |
- Source
Boolean
createSelectionAndStyle(selSpec, styleSpec)
Updates the state variable for selections and styles and trigger ui to show the
ui elements for these selections and styles.
Name | Type | Description |
---|---|---|
selSpec | AtomSelectionSpec | Atom Selection Spec |
styleSpec | AtomStyleSpec | Atom Style Spec |
- Source
createSurface(surfaceType, sel, style, sid)
Creates selection and add surface with reference to that selection
and triggers updates in the ui
Name | Type | Description |
---|---|---|
surfaceType | String | Type of surface to be created |
sel | AtomSelectionSpec | Atom selection spec |
style | AtomStyleSpec | Atom style spec |
sid | String | selection id |
- Source
editSurface(surfaceProperty)
Edit the exisiting surface in the viewport
Name | Type | Description |
---|---|---|
surfaceProperty | Object | Surface Style |
- Source
exitContextMenu(processContextMenu)
Executes hide context menu and process the label if needed
Name | Type | Description |
---|---|---|
processContextMenu | Boolean | Specify the need to process the values in the context menu |
- Source
getSelectionList()
Returns the list of ids of selections that are created so far
- Source
openContextMenu(atom, x, y)
Opens context menu when called from glviewer
Name | Type | Description |
---|---|---|
atom | AtomSpec | Atom spec obtained from context menu event |
x | Number | x coordinate of mouse on viewport |
y | Number | y coordinate of mouse on the viewport |
- Source
removeAtomLabel(atom)
Removes the atom label from the viewpoer
Name | Type | Description |
---|---|---|
atom | AtomSpec | Atom spec |
- Source
removeStyle(sid, stid)
Removes the style specified by stid
Name | Type | Description |
---|---|---|
sid | String | Selection id |
stid | String | Style Id |
- Source
removeSurface(id)
Removes surface from the viewport
Name | Type | Description |
---|---|---|
id | String | Surface Id |
- Source
setModelTitle(title)
Sets the value of title in ModelToolBar
Name | Type | Description |
---|---|---|
title | String | Model title |
- Source
toggleHide(sid)
Toggle the hidden property of the selection
Name | Type | Description |
---|---|---|
sid | String | Selection id |
- Source
toggleHideStyle(sid, stid)
Toggle hidden property of a style
Name | Type | Description |
---|---|---|
sid | String | Selection Id |
stid | String | Style Id |
- Source
updateUI()
Updates the UI on viewport change
- Source