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 labelValue
Object Output object from propertyMenu form of Context Menu
atom
AtomSpec 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 labelValue
Object Output object from label form of Context Menu
-
addModel(modelDesc)
-
Add model to the viewport
Parameters:
Name Type Description modelDesc
Object Model Toolbar output
-
addSelection(spec, sid)
-
Add Selection from the ui to glviewer
Parameters:
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
Returns:
String
-
addStyle(spec, sid, stid)
-
Add style and renders it into the viewport
Parameters:
Name Type Description spec
String Output object of style form
sid
String Selection Id
stid
String Style Id
Returns:
String
-
addSurface(property, callback)
-
Adds surface to the viewport
Parameters:
Name Type Description property
Object Surface output object
callback
function callback
Returns:
String
-
checkAtoms(sel)
-
Return true if the selections contain at least one atom
Parameters:
Name Type Description sel
AtomSelectionSpec 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 selSpec
AtomSelectionSpec Atom Selection Spec
styleSpec
AtomStyleSpec 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 surfaceType
String Type of surface to be created
sel
AtomSelectionSpec Atom selection spec
style
AtomStyleSpec Atom style spec
sid
String selection id
-
editSurface(surfaceProperty)
-
Edit the exisiting surface in the viewport
Parameters:
Name Type Description surfaceProperty
Object Surface Style
-
exitContextMenu(processContextMenu)
-
Executes hide context menu and process the label if needed
Parameters:
Name Type Description processContextMenu
Boolean 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 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
-
removeAtomLabel(atom)
-
Removes the atom label from the viewpoer
Parameters:
Name Type Description atom
AtomSpec Atom spec
-
removeStyle(sid, stid)
-
Removes the style specified by stid
Parameters:
Name Type Description sid
String Selection id
stid
String Style Id
-
removeSurface(id)
-
Removes surface from the viewport
Parameters:
Name Type Description id
String Surface Id
-
setModelTitle(title)
-
Sets the value of title in ModelToolBar
Parameters:
Name Type Description title
String Model title
-
toggleHide(sid)
-
Toggle the hidden property of the selection
Parameters:
Name Type Description sid
String Selection id
-
toggleHideStyle(sid, stid)
-
Toggle hidden property of a style
Parameters:
Name Type Description sid
String Selection Id
stid
String Style Id
-
updateUI()
-
Updates the UI on viewport change