new StateManager(glviewer, config)
$3Dmol.StateManager - StateManager creates the space to preserve the state of the ui and sync it with the GLViewer
Parameters:
| Name | Type | Description |
|---|---|---|
glviewer |
$3Dmol.GLViewer | 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 |
Methods
-
addAtomLabel(labelValue, atom)
-
Adds atom label to the viewport
Parameters:
Name Type Description labelValueObject Output object from propertyMenu form of Context Menu
atomAtomSpec Atom spec that are to be added in the label
-
addLabel(labelValue)
-
Adds Label to the viewport specific to the selection
Parameters:
Name Type Description labelValueObject Output object from label form of Context Menu
-
addModel(modelDesc)
-
Add model to the viewport
Parameters:
Name Type Description modelDescObject Model Toolbar output
-
addSelection(spec, sid)
-
Add Selection from the ui to glviewer
Parameters:
Name Type Description specObject Object that contains the output from the form
sidString If surface id being edited then sid is set to some string
Returns:
String
-
addStyle(spec, sid, stid)
-
Add style and renders it into the viewport
Parameters:
Name Type Description specString Output object of style form
sidString Selection Id
stidString Style Id
Returns:
String
-
addSurface(property, callback)
-
Adds surface to the viewport
Parameters:
Name Type Description propertyObject Surface output object
callbackfunction callback
Returns:
String
-
checkAtoms(sel)
-
Return true if the selections contain at least one atom
Parameters:
Name Type Description selAtomSelectionSpec Atom selection spec
Returns:
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.Parameters:
Name Type Description selSpecAtomSelectionSpec Atom Selection Spec
styleSpecAtomStyleSpec Atom Style Spec
-
createSurface(surfaceType, sel, style, sid)
-
Creates selection and add surface with reference to that selection
and triggers updates in the uiParameters:
Name Type Description surfaceTypeString Type of surface to be created
selAtomSelectionSpec Atom selection spec
styleAtomStyleSpec Atom style spec
sidString selection id
-
editSurface(surfaceProperty)
-
Edit the exisiting surface in the viewport
Parameters:
Name Type Description surfacePropertyObject Surface Style
-
exitContextMenu(processContextMenu)
-
Executes hide context menu and process the label if needed
Parameters:
Name Type Description processContextMenuBoolean Specify the need to process the values in the context menu
-
getSelectionList()
-
Returns the list of ids of selections that are created so far
Returns:
-
openContextMenu(atom, x, y)
-
Opens context menu when called from glviewer
Parameters:
Name Type Description atomAtomSpec Atom spec obtained from context menu event
xNumber x coordinate of mouse on viewport
yNumber y coordinate of mouse on the viewport
-
removeAtomLabel(atom)
-
Removes the atom label from the viewpoer
Parameters:
Name Type Description atomAtomSpec Atom spec
-
removeStyle(sid, stid)
-
Removes the style specified by stid
Parameters:
Name Type Description sidString Selection id
stidString Style Id
-
removeSurface(id)
-
Removes surface from the viewport
Parameters:
Name Type Description idString Surface Id
-
setModelTitle(title)
-
Sets the value of title in ModelToolBar
Parameters:
Name Type Description titleString Model title
-
toggleHide(sid)
-
Toggle the hidden property of the selection
Parameters:
Name Type Description sidString Selection id
-
toggleHideStyle(sid, stid)
-
Toggle hidden property of a style
Parameters:
Name Type Description sidString Selection Id
stidString Style Id
-
updateUI()
-
Updates the UI on viewport change