Documents > Application Programming Interface (API)
Hierarchy
- package ChemDoodle
- package extensions
- package featureDetection
- package iChemLabs
- package informatics
- class BondDeducer
- class HydrogenDeducer
- class Splitter
- class StructureBuilder
- class _Counter
- class FrerejacqueNumberCounter
- class NumberOfMoleculesCounter
- class _RingFinder
- class SSSRFinder
- class EulerFacetFinder
- package io
- package file
- package png
- package svg
- class _Interpreter
- class JSONInterpreter
- class JCAMPInterpreter
- class MOLInterpreter
- class RXNInterpreter
- class XYZInterpreter
- class PDBInterpreter
- class CIFInterpreter
- class CMLInterpreter
- package monitor
- package structures
- package d2
- class _Shape
- class Line
- class Pusher
- class AtomMapping
- class Bracket
- class RepeatUnit
- class VAP
- package d3
- class _Mesh
- class _Measurement
- class _Surface
- class Angle
- class Arrow
- class Box
- class Camera
- class Compass
- class Cylinder
- class FrameBuffer
- class Texture
- class Renderbuffer
- class SSAO
- class Distance
- class Fog
- class Line
- class Quad
- class Pill
- class Ribbon
- class Shape
- class SASSurface
- class SESSurface
- class Sphere
- class Star
- class Tube
- class UnitCell
- class VDWSurface
- class Light
- class Material
- class TextImage
- class TextMesh
- class Label
- class _Shader
- class DepthShader
- class FXAAShader
- class LabelShader
- class LightingShader
- class NormalShader
- class OutlineShader
- class PhongShader
- class PickShader
- class PositionShader
- class QuadShader
- class SSAOBlurShader
- class SSAOShader
- class Picker
- package d2
- package uis
- package actions
- class _Action
- class AddAction
- class AddContentAction
- class AddShapeAction
- class AddVAPAttachmentAction
- class ChangeBondAction
- class ChangeBracketAttributeAction
- class ChangeChargeAction
- class ChangeCoordinatesAction
- class ChangeRepeatUnitAttributeAction
- class ChangeLabelAction
- class ChangeLonePairAction
- class ChangeQueryAction
- class ChangeRadicalAction
- class ChangeEnhancedStereoAction
- class ChangeImplicitHydrogenAction
- class ChangeIsotopeAction
- class ChangeVAPOrderAction
- class ChangeVAPSubstituentAction
- class ClearAction
- class DeleteAction
- class DeleteContentAction
- class DeleteShapeAction
- class DeleteVAPConnectionAction
- class FlipAction
- class FlipBondAction
- class FlipRepeatUnitAction
- class MoveAction
- class NewMoleculeAction
- class RotateAction
- class SwitchContentAction
- class SwitchMoleculeAction
- class HistoryManager
- package gui
- package desktop
- class CursorManager
- class Button
- class ButtonSet
- class ColorPicker
- class CheckBox
- class DummyButton
- class DropDown
- class Tray
- class FloatingToolbar
- class TextButton
- class TextInput
- class Dialog
- class AtomQueryDialog
- class BondQueryDialog
- class MolGrabberDialog
- class SaveFileDialog
- class TemplateDialog
- class PeriodicTableDialog
- class Popover
- class EnhancedStereoPopover
- class ImplicitHydrogenPopover
- class IsotopePopover
- class DialogManager
- class ToolbarManager
- class stylesDialog
- class ToolbarManager3D
- package imageDepot
- package desktop
- package states
- class _State
- class ChargeState
- class RepeatUnitState
- class EraseState
- class LabelState
- class LassoState
- class LonePairState
- class MoveState
- class NewBondState
- class NewChainState
- class NewRingState
- class NewTemplateState
- class PusherState
- class QueryState
- class RadicalState
- class IsotopeState
- class ShapeState
- class TextInputState
- class VAPState
- class _State3D
- class ViewState3D
- class MeasureState3D
- class StateManager
- class StateManager3D
- package templateDepot
- class CopyPasteManager
- package actions
- class _Canvas
- class ViewerCanvas
- class HyperlinkCanvas
- class TransformCanvas
- class MolGrabberCanvas
- class FileCanvas
- class _AnimatorCanvas
- class RotatorCanvas
- class SlideshowCanvas
- class _Canvas3D
- class ViewerCanvas3D
- class TransformCanvas3D
- class MolGrabberCanvas3D
- class RotatorCanvas3D
- class MovieCanvas3D
- class _SpectrumCanvas
- class ObserverCanvas
- class OverlayCanvas
- class PerspectiveCanvas
- class SeekerCanvas
- class PeriodicTableCanvas
- class SketcherCanvas
- class EditorCanvas3D
- class StoichiometryTable
Documentation
ChemDoodle
this package is the root for all contents of the ChemDoodle Web Components library. It contains access to all packages, canvases and layouts as well as shortcut functions for common tasks.- static Array ELEMENT: a hashmap for elemental data where the element's symbol is the key and the corresponding Element data structure is the value
- static Array RESIDUE: a hashmap for residue data where the residue's symbol is the key and the corresponding Residue data structure is the value
- static Array SYMBOLS: a numbered Array containing all element symbols, where the index is the element's atomic number - 1 (index starts at 0 for hydrogen)
- static Function getVersion(): returns the version of the ChemDoodle Web Components library; changing this value in source is not recommended
- static Function readCIF(String content, Number xSuper, Number ySuper, Number zSuper): shortcut method to read a CIF file and return the corresponding Molecule and unit cell shape without instantiating a CIFInterpreter; the returned object will contain two parameters, molecule and unitCell; the three optional integers specify the supercell dimensions, by default they are all 1, so reading a file without specifying these parameters will produce just the unit cell. In addition to reading atoms from CIF files, this interpreter will also produce a unit cell and other objects relevant to the display of periodic information
returns Object - static Function readCML(): shortcut method to read CML and return the corresponding reaction data without instantiating an CMLInterpreter
returns Object - static Function readJCAMP(String content): shortcut method to read a IUPAC JCAMP-DX file and return the corresponding Spectrum without instantiating a JCAMPInterpreter; this shortcut method will automatically convert HZ to PPM
returns Spectrum - static Function readJSON(String content): shortcut method to read ChemDoodle JSON from a string and return an object with two parameters, molecules and shapes, without instantiating a JSONInterpreter; this function will automatically handle the type of JSON object received
returns Molecule - static Function readMOL(String content, Number multiplier): shortcut method to read a MDL MOLFile and return the corresponding Molecule without instantiating a MOLInterpreter; this function supports both v2000 and v3000 MOLFiles; the optional multiplier variable will override the default_anstromsPerBondLength variable, set it to 1 for 3D scenes in Ängstroms
returns Molecule - static Function readPDB(String content, Number multiplier): shortcut method to read a RCSB PDB file and return the corresponding Molecule without instantiating a PDBInterpreter; the optional multiplier variable will override the default_anstromsPerBondLength variable, set it to 1 for 3D scenes in Ängstroms. In addition to reading atoms from PDB files, this interpreter will also read residue data and generate ribbons and cartoons for that data
returns Molecule - static Function readRXN(String content, Number multiplier): shortcut method to read a MDL RXNFile and return the corresponding reaction data without instantiating an RXNInterpreter; the optional multiplier variable will override the default_anstromsPerBondLength variable, set it to 1 for 3D scenes in Ängstroms
returns Object - static Function readXYZ(String content): shortcut method to read a XYZ file and return the corresponding Molecule without instantiating a XYZInterpreter
returns Molecule - static Function writeCML(Array
Unit: molecules): shortcut method to write an CML File given an input Molecule array without instantiating an CMLInterpreter
returns String - static Function writeJSON(Array mols, Array shapes): shortcut method to write ChemDoodle JSON into a string given input Molecule and Shape arrays without instantiating a JSONInterpreter
returns String - static Function writeMOL(Molecule mol): shortcut method to write a V2000 MDL MOLFile given an input Molecule without instantiating a MOLInterpreter
returns String - static Function writeMOLV3(Molecule mol): shortcut method to write a V3000 MDL MOLFile given an input Molecule without instantiating a MOLInterpreter
returns String - static Function writeRXN(Array molecules, Array shapes): shortcut method to write an MDL RXNFile given an input Molecule array and Shape array without instantiating an RXNInterpreter
returns String
ChemDoodle._Canvas
is the parent class for all ChemDoodle Web Component Canvases, it should not be instantiated. Its basic functionality allows for molecules to be drawn and loaded. This class also hosts the system for handling user input events from the mouse and the keyboard. This class should be extended for custom canvases.constructor = new Function _Canvas()
- String id: the HTML id of the associated HTML element
- Integer width: the width the associated HTML element
- Integer height: the height of the associated HTML element
- Styles styles: the visual specifications that define how content should be painted
- Array molecules: an array of Molecule data structures that the Canvas renders
- Array shapes: an array of Shape data structures that the Canvas renders
- String emptyMessage: the message to be displayed if there is no content currently present for the canvas to render. If this variable is undefined, no message is displayed if there is no content
- Image image: the background image, overrides the VisualSpecification backgroundColor property; if undefined, no image is drawn
- Boolean doEventDefault: all default browser event actions (like scrolling, text input) are blocked when performed above the Canvas, set this variable to true to disable this, as is done when the sketcher needs text input
Default Value: false
Unit: true/false - Function addMolecule(Molecule mol): loads the given Molecule, mol, and checks it; the current content of the canvas is not cleared, the input mol is pushed as the next element of the molecules array; repaints canvas
- Function addShape(_Shape shape): loads the given Shape, shape; the current content of the canvas is not cleared, the input shape is pushed as the next element of the shapes array; repaints canvas
- Function bondExists(Atom a1, Atom a2): returns true if a bond exists in one of the Canvas's molecules that contains the two parameter atoms
returns Boolean - Function center(): centers the loaded content in the canvas
- Function clear(): clears the canvas by emptying the molecules and shapes arrays and then repaints; resets the scale back to 1
- Function create(String id, Integer width, Integer height): this function places the canvas in the HTML page and is called in every constructor of the children classes. The id is the HTML id of the canvas element, with width and height its dimensions
- Function getAllAtoms(): returns an Array containing all of the atoms of the molecules contained within the canvas
returns Array - Function getAllBonds(): returns an Array containing all of the bonds of the molecules contained within the canvas
returns Array - Function getAllPoints(): returns an Array containing all of the Atoms of the molecules and Points of the shapes contained within the canvas
returns Array - Function getBond(Atom a1, Atom a2): returns the bond present in the Canvas's molecules that contains the two parameter atoms; if such a bond does not exist, undefined is returned
returns Bond - Function getContentBounds(): returns a Bounds object containing the 2D bounds of all of the graphics in the Canvas
returns Bounds - Function getMolecule(): returns the first Molecule element in the molecules array currently associated with the canvas
returns Molecule - Function getMoleculeByAtom(Atom a): returns the Molecule in the Canvas's molecules array that contains the parameter atom; if such a molecule does not exist, undefined is returned
returns Molecule - Function getMolecules(): returns the Canvas's array of Molecule objects
returns Array
Unit: Molecule - Function loadContent(Array mols
Unit: Molecule, Array shapes
Unit: Shape): loads the given Molecules and Shapes in the provided mols and shapes Arrays; the current content of the canvas is cleared, the input arrays become the new molecules and shapes Arrays; checks molecules and repaints canvas - Function loadMolecule(Molecule mol): loads the given Molecule, mol, and checks it; the current content of the canvas is cleared, the input mol is placed as the first element of the molecules array; repaints canvas
- Function prehandleEvent(Event e): conditions the user input event and sets a new variable in the Event object named p that contains the coordinates of the event in the canvas
- Function removeMolecule(Molecule mol): removes the given Molecule, mol from the molecules array; repaints canvas
- Function removeShape(_Shape shape): removes the given Shape, shape from the shapes array; repaints canvas
- Function repaint(): repaints the canvas
- Function resize(Integer width, Integer height): resizes the canvas to the input width and height parameters, this is done efficiently and is the prefered way to resize Canvas objects; this function will automatically recenter content and perform the necessary functions to update rendering
- Function setBackgroundImage(String url): sets the background image to the image specified by the url parameter
- optional abstract Function afterLoadContent(): additional function that is called after content is loaded into the Canvas; is called in the loadMolecule and loadContent functions
- optional abstract Function checksOnAction(Boolean force): set up some internal variables, usually for shapes before drawing in the uis interfaces; force determines whether the check happens now or later
- optional abstract Function drawChildExtras(Context ctx, Styles styles): draws extra graphics on top of the base graphics, override this for your custom canvases
- optional abstract Function subCreate(): additional function to be called during create(), such that child classes can do additional setup before returning to the child constructor
- //Mobile Touch Events and Gestures
- optional abstract Function dbltap(Event e): receives the double tap event for mobile devices, override this for your custom canvases, forwards to dblclick if not implemented, if neither dbltap or dblclick are implemented, then the event is forwarded to touchstart or mousedown
- optional abstract Function gesturechange(Event e): receives the gesture move event for mobile devices, override this for your custom canvases
- optional abstract Function gestureend(Event e): receives the touch end event for mobile devices, override this for your custom canvases
- optional abstract Function gesturestart(Event e): receives the gesture start event for mobile devices, override this for your custom canvases
- optional abstract Function multitouchmove(Event e, Number numFingers): receives an event for mobile devices where multiple fingers are moving on the screen, override this for your custom canvases, the center of the fingers is provided in the Event, the number of fingers touching the screen is also sent to the handler
- optional abstract Function tap(Event e): receives the tap event for mobile devices (quickly touchstart then touchend), override this for your custom canvases, forwards to click if not implemented
- optional abstract Function touchend(Event e): receives the touch end event for mobile devices, override this for your custom canvases, forwards to mouseup if not implemented
- optional abstract Function touchhold(Event e): receives the touch hold event for mobile devices, override this for your custom canvases; will fire if the user touches down and does not lift or move for 1 second
- optional abstract Function touchmove(Event e): receives the touch move event for mobile devices, override this for your custom canvases, forwards to drag if not implemented
- optional abstract Function touchstart(Event e): receives the touch start event for mobile devices, override this for your custom canvases, forwards to mousedown if not implemented
- //Mouse Events
- optional abstract Function click(Event e): receives the mouse click event, override this for your custom canvases
- optional abstract Function contextmenu(Event e, Number delta): receives the contextmenu event, responding to the right mouse button being pressed down to open the context menu
- optional abstract Function dblclick(Event e): receives the mouse double click event, override this for your custom canvases
- optional abstract Function drag(Event e): receives the mouse drag event, override this for your custom canvases
- optional abstract Function middleclick(Event e): receives the mouse middle click event, override this for your custom canvases
- optional abstract Function middlemousedown(Event e): receives the mouse middle mouse down event, override this for your custom canvases
- optional abstract Function middlemouseup(Event e): receives the mouse middle mouse up event, override this for your custom canvases
- optional abstract Function mousedown(Event e): receives the mouse down event, override this for your custom canvases
- optional abstract Function mousemove(Event e): receives the mouse move event, override this for your custom canvases
- optional abstract Function mouseout(Event e): receives the mouse out event, override this for your custom canvases
- optional abstract Function mouseover(Event e): receives the mouse over event, override this for your custom canvases
- optional abstract Function mouseup(Event e): receives the mouse up event, override this for your custom canvases
- optional abstract Function mousewheel(Event e, Number delta): receives the mouse wheel event, override this for your custom canvases; delta is the amount the wheel has spun
- optional abstract Function rightclick(Event e): receives the mouse right click event, override this for your custom canvases
- optional abstract Function rightmousedown(Event e): receives the mouse right mouse down event, override this for your custom canvases
- optional abstract Function rightmouseup(Event e): receives the mouse right mouse up event, override this for your custom canvases
- //Keyboard Events
- optional abstract Function keydown(Event e): receives the key down event, override this for your custom canvases
- optional abstract Function keypress(Event e): receives the key press event, override this for your custom canvases
- optional abstract Function keyup(Event e): receives the key up event, override this for your custom canvases
ChemDoodle.ViewerCanvas
is a child of the Canvas class and provides a basic canvas for simply displaying a static styled structural drawingconstructor = new Function ViewerCanvas(String id, Integer width, Integer height)
prototype = _Canvas
ChemDoodle.HyperlinkCanvas
is a child of the Canvas class and provides a basic button-like canvas: it responds to mouse overs and executes a link or action when clicked onconstructor = new Function HyperlinkCanvas(String id, Integer width, Integer height, String urlOrFunction)
prototype = _Canvas
- String urlOrFunction: this is the url to be directed to when clicked, this can also be a function object and the function will be executed when clicked
- String color: the color of the mouse over highlight
Default Value: blue
Unit: color - Number size: the width of the mouse over highlight
Default Value: 2
Unit: pixels - Boolean openInNewWindow: if true and urlOrFunction is a url, then the url will be opened in a new window instead of changing the current page
Default Value: false
Unit: true/false - Image hoverImage: if this is initialized, then the mouse over will display an image instead of a hyperlink-like decoration
- Event e: keeps track of the last event
- Function setHoverImage(String url): sets the canvas's hover image to the image url specified
- override Function click(Event e): performs the mouse click action
- override Function drawChildExtras(Context ctx): draws extra graphics on top of the base graphics
- override Function mouseout(Event e): performs the mouse out action
- override Function mouseover(Event e): performs the mouse over action, currently not called
ChemDoodle.TransformCanvas
is a child of the Canvas class and provides a basic canvas for users to transform (translate [alt+drag], rotate [drag], scale [mousewheel]) molecules withconstructor = new Function TransformCanvas(String id, Integer width, Integer height)
prototype = _Canvas
- Point lastPoint: keeps track of the last mouse position
- Boolean rotate3D: will rotate in 3 dimensions if true, will only rotate around the z axis if false
Default Value: false - Number rotationMultMod: multiplication modifier for the rotation calculations, larger numbers correspond to faster rotations
Default Value: 1.3 - Number lastPinchScale: keeps track of the last pinch scale from a mobile gesture
- Number lastGestureRotate: keeps track of the last rotation magnitude from a mobile gesture
- override Function dblclick(Event e): performs the double-click action, which centers the molecule
- override Function drag(Event e): performs the mouse drag action
- override Function gesturechange(Event e): handles any pinch and rotate gestures from mobile devices which will scale and rotate the molecule
- override Function gestureend(Event e): resets the gesture tracking variables and ends the gesture
- override Function mousedown(Event e): performs the mouse down action
- override Function mousewheel(Event e, Number delta): performs the mouse wheel action
ChemDoodle.MolGrabberCanvas
is a child of the Canvas class and provides a basic canvas for users to search databases with.constructor = new Function MolGrabberCanvas(String id, Integer width, Integer height)
prototype = _Canvas
- Function getInputFields(): generates the HTML for the database drop down and submit buttons
- Function search(): uses iChemLabs cloud services to contact the database with query term as defined in the form and then updates the Canvas after receiving the molecule data
- Function setSearchTerm(String term): automatically searches for and loads the input search term
ChemDoodle.FileCanvas
is a child of the Canvas class and provides a basic canvas for users to load molecule from their computer with. The action is the server side script to be called that loads the file into a hidden frame. After the asynchronous call is finished, the correct function is called to load the molecule into the canvas with the associated idconstructor = new Function FileCanvas(String id, Integer width, Integer height, String String, String urlOrFunction, String color, Number size)
prototype = _Canvas
ChemDoodle._AnimatorCanvas
is a child of the Canvas class and is the parent class for all animated ChemDoodle Web Component Canvases, it should not be instantiated. It provides an extendable framework for creating animations. This class should be extended for custom animated canvases.constructor = new Function _AnimatorCanvas()
prototype = _Canvas
- Timer handle: a handle on the current Timer so it can be started and stopped
- Number timeout: the default refresh rate
Default Value: 33 (~30fps)
Unit: ms - Number lastTime: keeps track of the last time the nextFrame() function was called
- Function isRunning(): returns true if the animation is currently running
returns Boolean
Unit: true/false - Function startAnimation(): initializes the animation
- Function stopAnimation(): terminates the animation
- abstract Function nextFrame(Number delta): called by the timer, in the frequency specified by the interval timeout, this must be overridden for your custom canvases, repaints the canvas after each call; this class keeps track of the time between calls and passes that value to this function for accurate animations
ChemDoodle.RotatorCanvas
is a child of the AnimatorCanvas class and provides a basic canvas for displaying molecular rotation animationsconstructor = new Function RotatorCanvas(String id, Integer width, Integer height, String String, Boolean rotate3D)
prototype = _AnimatorCanvas
- Boolean rotate3D: the animation will rotate in 3 dimensions if true, will only rotate around the z axis if false
Default Value: false - Number xIncrement: the x rotation increment
Default Value: Math.PI/15
Unit: radians/sec - Number yIncrement: the y rotation increment
Default Value: Math.PI/15
Unit: radians/sec - Number zIncrement: the z rotation increment
Default Value: Math.PI/15
Unit: radians/sec - override Function dblclick(Event e): catches double click events and toggles the animation
- override Function nextFrame(Number delta): updates the state during the rotation animation
ChemDoodle.SlideshowCanvas
is a child of the AnimatorCanvas class and provides a basic canvas for displaying transitions between several molecular structuresconstructor = new Function SlideshowCanvas(String id, Integer width, Integer height)
prototype = _AnimatorCanvas
- Array molecules: the molecular structures to be displayed in the order they are to be displayed in, this should not be empty
- Integer curIndex: keeps track of the current index in molecules
- Number timeout: this parameter is inherited from AnimatorCanvas, but it is set to a larger value
Default Value: 5000
Unit: ms - Number alpha: keeps track of the current alpha during the transition
- Timer innerHandle: holds on to the second inner Timer for performing the transition, so it can be started and stopped
- Integer phase: keeps track of the current phase (different types of animations) during the transition
- Function addMolecule(Molecule molecule): adds a molecule to the slideshow
- Function breakInnerHandle(): completes the second phase of the animation and the molecule switch
- override Function drawChildExtras(Context ctx): draws extra graphics on top of the base graphics
- override Function nextFrame(Number delta): updates the state during the rotation
ChemDoodle._Canvas3D
is the parent class for all 3D ChemDoodle Web Component Canvases, it should not be instantiated. Its basic functionality allows for molecules to be rendered in a 3D scene and loaded. This class should be extended for custom 3D canvases.constructor = new Function _Canvas3D()
prototype = _Canvas
- static String PRESERVE_DRAWING_BUFFER: by default, the webgl context will not preserve the drawing buffer, leading to performance improvements; however you may wish to set this to true to preserve the buffer if you wish to use the ChemDoodle.io.png class to output the Canvas3D to PNG; once a Canvas3D is created, the context will have this value bound and the context cannot be changed after initialization (you will need to create a new Canvas3D with the different value)
Default Value: false
Unit: true/false - mat4 rotationMatrix: the rotation matrix to be applied before rendering the 3D scene
Default Value: mat4.identity([])
Unit: 4x4 matrix - Array contentCenter: the translation (actually the negative of the center of the scene content) to be applied before rendering the 3D scene
Default Value: [0, 0, 0]
Unit: Array of length 3 - Point lastPoint: the last point in the canvas's space that the user initiated a mouseDown event
- String emptyMessage: overridden to 'WebGL is Unavailable!', to be displayed by default if the WebGL context creation fails
Default Value: WebGL is Unavailable! - Number lastPinchScale: keeps track of the pinch scale for mobile gestures
- Number lastGestureRotate: keeps track of the gesture rotate value for mobile gestures
- Function deferredRender(): pipeline for deferred rendering
- Function displayMessage(): controls what the Canvas3D displays if WebGL is unavailable
- Function forwardRender(): pipeline for immediate rendering
- Function isSupportDeferred(): returns true if the 3D context is capable of supporting deferred rendering
returns Boolean - Function pick(Number x, Number y, Boolean includeAtoms, Boolean includeBonds): returns the atom or bond that is located in the 3D scene, closest to the camera, at the <canvas> coordinates of the input x and y values; if no object is at those coordinates, undefined is returned; includeAtoms and includeBonds define whether those objects are selectable (if you make both true and you are only looking to select atoms, bonds will get in the way of selecting atoms)
- Function renderColor(): deferred rendering color pass
- Function renderDepthMap(): renders the scene to the shadow FBO
- Function renderExtras(): helper method for rendering decorative components of the scene
- Function renderNormal(): deferred rendering normal pass
- Function renderOutline(): deferred rendering Outline pass
- Function renderPosition(): deferred rendering position pass
- Function renderSSAO(): deferred rendering SSAO pass
- Function renderText(String text, Array position): helper method for rendering text
- Function setupScene(): creates the 3D scene
- Function updateScene(): updates the projection for the scene without other overhead
- override Function afterLoadContent(): helper method to reset the scene if a gl parameter has been altered
- override Function center(): centers the molecule in 3D around the origin
- override Function drag(Event e): performs the mouse drag action
- override Function gesturechange(Event e): performs the gesturechange action
- override Function mousedown(Event e): performs the mouse down action
- override Function mousedown(Event e): performs the mouse up action
- override Function mousewheel(Event e): performs the mouse scroll action
- override Function multitouchmove(Event e): performs the multitouchmove action
- override Function repaint(): renders the 3D scene
- override Function rightmousedown(Event e): performs the mouse right click action
- override Function subCreate(): sets up GLContext, alerts viewer to warning if GLContext cannot be created; initializes shaders and scene
ChemDoodle.ViewerCanvas3D
is a child of the Canvas3D class and provides a basic canvas for simply displaying a static 3D scene of a moleculeconstructor = new Function ViewerCanvas3D(String id, Integer width, Integer height)
prototype = _Canvas
- override Function drag(): set to undefined to ignore this gesture
- override Function mousedown(): set to undefined to ignore this gesture
- override Function mousewheel(): set to undefined to ignore this gesture
- override Function rightmousedown(): set to undefined to ignore this gesture
ChemDoodle.TransformCanvas3D
is a child of the Canvas3D class and provides a basic canvas for users to transform (translate [alt+drag], rotate [drag], scale [mousewheel]) molecules with in a 3D sceneconstructor = new Function TransformCanvas3D(String id, Integer width, Integer height)
prototype = _Canvas
ChemDoodle.MolGrabberCanvas3D
is a child of the Canvas3D class and provides a basic 3D canvas for users to search databases with. The content may then be transformed just as in the Transformer3D canvas.constructor = new Function MolGrabberCanvas3D(String id, Integer width, Integer height)
prototype = _Canvas3D
- Function search(): uses iChemLabs cloud services to contact the database with query term as defined in the form and then updates the Canvas3D after receiving the molecule data
- Function setSearchTerm(String term): automatically searches for and loads the input search term
ChemDoodle.RotatorCanvas3D
is a child of the Canvas3D class and provides a basic canvas for displaying molecular rotation animations in a 3D scene, also doubly inherits methods from the AnimatorCanvas classconstructor = new Function RotatorCanvas3D(String id, Integer width, Integer height)
prototype = _Canvas3D
- Timer handle: a handle on the current Timer so it can be started and stopped
- Number timeout: the default refresh rate
Default Value: 33 (~30fps)
Unit: ms - Number xIncrement: the x rotation increment
Default Value: Math.PI/15
Unit: radians/sec - Number yIncrement: the y rotation increment
Default Value: Math.PI/15
Unit: radians/sec - Number zIncrement: the z rotation increment
Default Value: Math.PI/15
Unit: radians/sec - Function isRunning(): returns true if the animation is currently running
returns Boolean
Unit: true/false - Function startAnimation(): initializes the animation
- Function stopAnimation(): terminates the animation
- override Function dblclick(Event e): catches double click events and toggles the animation
- override Function drag(): set to undefined to ignore this gesture
- override Function mousedown(): set to undefined to ignore this gesture
- override Function mousewheel(): set to undefined to ignore this gesture
- override Function nextFrame(Number delta): updates the state during the rotation animation
- override Function rightmousedown(): set to undefined to ignore this gesture
ChemDoodle.MovieCanvas3D
is a child of the Canvas3D class and provides a basic canvas for displaying movies of molecules in a 3D scene, also doubly inherits methods from the AnimatorCanvas classconstructor = new Function MovieCanvas3D(String id, Integer width, Integer height)
prototype = _Canvas3D
- static Number PLAY_ONCE: specifies that movie will play once to the end and stop
- static Number PLAY_LOOP: specifies that movie will play continuously, restarting from the first frame once it reaches the end
- static Number PLAY_SPRING: specifies that movie will play continuously, springing back and forth between the first and last frames
- Array frames: an array containing molecules and shapes, with each entry representing a frame to be displayed in the order they are to be displayed in, this should not be empty; you should fill this array before the _Canvas.loadMolecule() function is called so all the data is properly setup
- Timer handle: a handle on the current Timer so it can be started and stopped
- Number timeout: the default refresh rate
Default Value: 50 (~20fps)
Unit: ms - Number playMode: set to specify how the movie playback will proceed
Allowed Values: [MovieCanvas3D.PLAY_ONCE, MovieCanvas3D.PLAY_LOOP, MovieCanvas3D.PLAY_SPRING]
Default Value: PLAY_SPRING
Unit: MovieCanvas3D.PLAY_* - Boolean reverse: used internally to allow the spring playback method to function
- Number frameNumber: keeps track of the next frame number
- Function addFrame(Array mols, Array shapes): takes an array of molecules and shapes and adds them to the end of the frame array.
- Function isRunning(): returns true if the animation is currently running
returns Boolean
Unit: true/false - Function startAnimation(): initializes the animation
- Function stopAnimation(): terminates the animation
- override Function center(): centers all of the frames in the molecules array
- override Function dblclick(Event e): catches double click events and toggles the animation
- override Function nextFrame(Number delta): updates the state during the rotation animation
ChemDoodle._SpectrumCanvas
is a child of the Canvas class and is the parent class for all Spectrum ChemDoodle Web Component Canvases, it should not be instantiated. This canvas is specifically suited for displaying graphics of spectra.constructor = new Function _SpectrumCanvas()
prototype = _Canvas
- Spectrum spectrum: the Spectrum data structure that this Canvas displays
- Function getSpectrum(): returns the Spectrum belonging to this SpectrumCanvas
returns Spectrum - Function loadSpectrum(): loads the spectrum and then repaints
- override Function repaint(): paints the spectrum
ChemDoodle.ObserverCanvas
is a child of the SpectrumCanvas class and provides a basic canvas for simply displaying a static styled spectrum drawingconstructor = new Function ObserverCanvas(String id, Integer width, Integer height)
prototype = _SpectrumCanvas
ChemDoodle.OverlayCanvas
is a child of the SpectrumCanvas class and provides an basic canvas for viewing several spectra superimposed over each otherconstructor = new Function OverlayCanvas(String id, Integer width, Integer height)
prototype = _SpectrumCanvas
- Array overlaySpectra: the additional spectra to be overlaid on the main spectrum
Default Value: Array - Function addSpectrum(Spectrum spectrum): adds a spectrum to the canvas; it is recommended that this function is used over directly populating the overlaySpectra array, as this function will first set the main spectrum if it isn't set
- override Function innerRepaint(Context ctx): draws extra graphics on top of the base graphics
ChemDoodle.PerspectiveCanvas
is a child of the SpectrumCanvas class and provides an interactive canvas for zooming in on peaks in spectraconstructor = new Function PerspectiveCanvas(String id, Integer width, Integer height)
prototype = _SpectrumCanvas
- Point dragRange: keeps track of the x-coordinates for the start and end of the drag event
- Boolean rescaleYAxisOnZoom: determines whether the y-axis will rescale upon a zoom
Default Value: true
Unit: true/false - Number lastPinchScale: keeps track of the last pinch scale from a mobile gesture
- override Function dblclick(Event e): performs the double-click action, which fits the entire spectrum to the canvas
- override Function drag(Event e): performs the mouse drag action, which will zoom in on the spectrum; if the shift key is held, then the spectrum will be translated
- override Function drawChildExtras(Context ctx): draws extra graphics on top of the base graphics
- override Function gesturechange(Event e): handles any pinch gestures from mobile devices which will scale the spectrum
- override Function mousedown(Event e): performs the mouse down action
- override Function mouseup(Event e): performs the mouse up action
- override Function mousewheel(Event e, Number delta): performs the mouse wheel action
ChemDoodle.SeekerCanvas
is a child of the SpectrumCanvas class and provides an interactive canvas for viewing internal coordinates in spectraconstructor = new Function SeekerCanvas(String id, Integer width, Integer height, String seekType)
prototype = _SpectrumCanvas
- static String SEEK_POINTER: seeks the pointer location
- static String SEEK_PLOT: seeks closest plot coordinate by the x coordinate of the pointer location
- static String SEEK_PEAK: seeks closest peak coordinate by the x coordinate of the pointer location
- String seekType: seek method for the canvas, must be one of the SEEK constants
Default Value: SEEK_POINTER - Point p: keeps track of the last point from the user
- override Function innerRepaint(Context ctx): draws extra graphics on top of the base graphics
- override Function mousemove(Event e): performs the mouse move action
- override Function mouseout(Event e): performs the mouse out action
- override Function touchend(Event e): performs the touch end action
- override Function touchmove(Event e): performs the touch move action
- override Function touchstart(Event e): performs the touch start action
ChemDoodle.PeriodicTableCanvas
is a child of the Canvas class and displays a periodic table of elements. As with all components, it is completely customizable and interactive.constructor = new Function PeriodicTableCanvas(String id, Integer cellDimension)
prototype = _Canvas
- Number padding: the padding between the sides of the component and the table
Default Value: 5
Unit: pixels - Number cellDimension: the width and height of each cell in the periodic table, 20 by default, but also specified in the constructor
Default Value: 20
Unit: pixels - PeriodicCell hovered: the currently hovered cell, or undefined if there is no cell hovered
- PeriodicCell selected: the currently selected cell, or undefined if there is no cell selected
- Function drawCell(Context ctx, Styles styles, PeriodicCell cell): draws the provided cell to the canvas that owns the Context using the given Styles, override this function to change the rendering of the table
- Function getHoveredElement(): returns the Element object corresponding to the cell that is currently hovered by the mouse pointer, and returns undefined if no cell is hovered
returns Element - override Function click(Event e): catches double click events and selects a cell
- override Function getMolecule(): set to undefined to ignore this function from the _Canvas class
- override Function mousemove(Event e): catches mouse move events and hovers a cell
- override Function mouseout(Event e): catches mouse out events and sets the hovered cell to undefined
- override Function repaint(): paints the periodic table
- override Function setMolecule(): set to undefined to ignore this function from the _Canvas class
- override Function setupTable(): sets up the table and all the table cells, this function is called by the constructor, but can be called after changing the constructor defaults to re-layout the table
- override Function touchstart(Event e): catches the touchstart mobile event and hovers a cell
ChemDoodle.SketcherCanvas
is a child of the Canvas class and provides a full sketcher for drawing chemical data, modeled off of the popular ChemDoodle 2D application. This class is not avaialble in the ChemDoodle Web Components core. It is added by including the ChemDoodle Web Components uis extensions.constructor = new Function SketcherCanvas(String id, Integer width, Integer height, Object options)
prototype = _Canvas
- Boolean isMobile: this is one of the options, controls whether the sketcher optimizes itself for mobile or desktop use; if not defined, this option will automatically default to the correct value after checking if it's environemnt is mobile or not
Default Value: ChemDoodle.featureDetection.supports_touch()
Unit: true/false - Boolean useServices: this is one of the options, controls whether or not the sketcher will provide functionality that access iChemLabs Cloud services
Default Value: false
Unit: true/false - Boolean oneMolecule: this is one of the options, controls whether or not the sketcher will provide full sketching capabilities, or restrict the interface to allow only a single molecule to be drawn
Default Value: false
Unit: true/false - Boolean includeToolbar: this is one of the options, define this to false to exclude the toolbar
Default Value: true
Unit: true/false - Boolean floatDrawTools: this is one of the options, define this to true if you want to show a floating toolbar for the drawing tools as in ChemDoodle 2D
Default Value: false
Unit: true/false - Boolean resizable: this is one of the options, define this to true if you want the sketcher to be resizable by the user
Default Value: false
Unit: true/false - Boolean includeQuery: this is one of the options, define this to true to inlcude query tools in the toolbar
Default Value: false
Unit: true/false - ToolbarManager toolbarManager: the toolbar manager
- StateManager stateManager: the state manager
- HistoryManager historyManager: the history manager
- CopyPasteManager copyPasteManager: the copy/paste manager
- CursorManager cursorManager: the cursor manager
- TextInput textInput: the TextInput object used for text input in custom labels
- Popover modal: if this is not undefined, the sketcher goes into modal mode and all input events are blocked; this value is a pointer to the current modal popup, and is closed automatically when the user clicks on sketcher outside of the popover
- Tray openTray: if this is defined, there is a tray open on the floating toolbar, and this parameter is a pointer to that tray
- Boolean isHelp: true if the user is hovering over the help icon
- Number lastPinchScale: keeps track of the pinch gesture
- Number lastGestureRotate: keeps track of the two finger rotate gesture
- Point lastMousePos: this keeps track of where the mouse is over the canvas, set in State
- Point lastPoint: this keeps track of the last drag gesture position, set in State
- Atom startAtom: the atom that follows the pointer in the full sketcher
- Lasso lasso: the lasso, only declared in the full sketcher
- Function checkScale(): confines the scale of the sketcher
- Function checksOnAction(Boolean force): set up some internal variables on executing an action, currently checks query shapes for errors, override this for your custom sketcher listeners; if force is false, the function remembers that it should do this when next called by true, which is called in _Canvas.repaint()
- Function drawSketcherDecorations(Context ctx): draws extra graphics for the sketcher
- Function scaleEvent(Event e): scales the event for the current scale of the sketcher
- override Function checksBeforeRepaint(): set up some internal variables before repainting
- override Function click(Event e): performs the mouse click action
- override Function dblclick(Event e): performs the mouse dblclick action
- override Function drag(Event e): performs the drag action
- override Function drawChildExtras(Context ctx): draws extra graphics on top of the base graphics
- override Function gesturechange(Event e): performs the gesturechange action
- override Function gestureend(Event e): performs the gestureend action
- override Function keydown(Event e): performs the keydown action
- override Function keypress(Event e): performs the keypress action
- override Function keyup(Event e): performs the keyup action
- override Function mousedown(Event e): performs the mousedown action
- override Function mouseout(Event e): performs the mouseout action
- override Function mouseover(Event e): performs the mouseover action
- override Function mouseup(Event e): performs the mouseup action
- override Function mousewheel(Event e): performs the mousewheel action
- override Function rightclick(Event e): performs the mouse rightclick action
- override Function rightmousedown(Event e): performs the rightmousedown action
- override Function rightmouseup(Event e): performs the rightmouseup action
- override Function touchend(Event e): performs the touchend action
- override Function touchmove(Event e): performs the touchmove action
- override Function touchstart(Event e): performs the touchstart action
ChemDoodle.EditorCanvas3D
is a child of the Canvas class and provides a 3D molecular editing environment. This class is not avaialble in the ChemDoodle Web Components core. It is added by including the ChemDoodle Web Components uis extensions.constructor = new Function EditorCanvas3D(String id, Integer width, Integer height, Object options)
prototype = _Canvas3D
- Boolean isMobile: this is one of the options, controls whether the editor optimizes itself for mobile or desktop use; if not defined, this option will automatically default to the correct value after checking if it's environemnt is mobile or not
Default Value: ChemDoodle.featureDetection.supports_touch()
Unit: true/false - Boolean useServices: this is one of the options, controls whether or not the editor will provide functionality that access iChemLabs Cloud services
Default Value: false
Unit: true/false - Boolean includeToolbar: this is one of the options, define this to false to exclude the toolbar
Default Value: true
Unit: true/false - ToolbarManager3D toolbarManager: the toolbar manager
- StateManager3D stateManager: the state manager
- HistoryManager historyManager: the history manager
- override Function click(Event e): performs the mouse click action
- override Function dblclick(Event e): performs the mouse dblclick action
- override Function drag(Event e): performs the drag action
- override Function keydown(Event e): performs the keydown action
- override Function keypress(Event e): performs the keypress action
- override Function keyup(Event e): performs the keyup action
- override Function mousedown(Event e): performs the mousedown action
- override Function mouseout(Event e): performs the mouseout action
- override Function mouseover(Event e): performs the mouseover action
- override Function mouseup(Event e): performs the mouseup action
- override Function mousewheel(Event e): performs the mousewheel action
- override Function rightclick(Event e): performs the mouse rightclick action
- override Function rightmousedown(Event e): performs the rightmousedown action
- override Function rightmouseup(Event e): performs the rightmouseup action
ChemDoodle.StoichiometryTable
the StoichiometryTable class produces a chemically intelligent and self-calculating table for stoichiometry calculations. It is modeled after the stoichiometry table tool in ChemDoodle 2D. This component is based on a <table> element instead of a <canvas> element.constructor = new Function StoichiometryTable(String id, Object options)
- Button buttonCancel: this is the cancel button for the cell data input
- Button buttonClear: this is the clear button for the cell data input
- Object currentTableData: this is the current state of the stoichiometry table
- Object tableContainer: this is the jQuery reference to the table element in the DOM
- Array editableCells: this array contains the cells of the stoichiometry table that are editable; the entries are CellData objects, a class private to the StoichiometryTable class
- Function closeEdit(Boolean commit): closes the currently opened edit component for a cell in the table, committing the action only if the commit parameter is true
- Function closeEditCheckNotInEditDiv(): closes the currently opened edit component if the user clicks elsewhere on the page
- Function makeEditComponent(): produces the HTML for the edit component for the cells where users input values and units, returning the HTML as a String
returns String html - Function makeTableContainer(): produces the container HTML where the stoichiometry table will exist, returning the HTML as a String
returns String html - Function serverSetup(Object data): handles the original creation of the stoichiometry table based on the input data; the data object can be either a String (written equation) or a drawn reaction
- Function serverUpdate(Event currentTableData): handles the updating of the stoichiometry table given the updated table data
- Function setupInteractivity(): defines the user interactivity actions for the stoichiometry table and its cells
- Function setupStoichiometryTable(Object tableData): produces the HTML for the stoichiometry table based on the input tableData
- Function updateStoichiometryTable(Object tableData): updates the DOM elements for the stoichiometry table based on the input tableData
ChemDoodle.extensions
this package contains helper functions for classes that the ChemDoodle Web Components library doesn't own.- static Function contextEllipse(Context ctx, Number x, Number y, Number w, Number h): draws a ellipse given an input Context, x and y coordinates for the center position, and a width and height
- static Function contextRoundRect(Context ctx, Number x, Number y, Number width, Number height, Number radius): draws a rounded rectangle given an input Context, x and y coordinates for the center position, height, width, and radius
- static Function getFontString(Number size, String family, Boolean bold, Boolean italic): generates a valid CSS font string based on the input parameters
returns String css - static Function vec3AngleFrom(vec3 v1, vec3 v2): returns the angle between the two input vec3 objects
returns Number
ChemDoodle.featureDetection
this package contains several convenience methods to check for support of verious HTML5 features that the ChemDoodle Web Components library uses.- static Function supports_canvas(): returns a boolean corresponding to the browser's support for the HTML5 <canvas> tag
returns Boolean - static Function supports_canvas_text(): returns a boolean corresponding to the browser's support for HTML5 <canvas> text rendering
returns Boolean - static Function supports_gesture(): returns a boolean corresponding to the browser's support for gesture events; this is useful for determining if the current browser can support pinching and zooming, and to resort to ChemDoodle's handlers if necessary
returns Boolean - static Function supports_touch(): returns a boolean corresponding to the browser's support for touch events; this is useful for determining if the current browser is on a mobile platform
returns Boolean - static Function supports_webgl(): returns a boolean corresponding to the browser's support for WebGL
returns Boolean - static Function supports_xhr2(): this method checks the browser's support for XMLHttpRequest Level 2 functionality
returns Boolean
ChemDoodle.iChemLabs
this package connects to iChemLabs cloud services through AJAX XMLHttpRequest Level 2 for complete access to the entire ChemDoodle Java API. Please see the iChemLabs Cloud services documentation for details.ChemDoodle.informatics
this package hosts all classes that perform cheminformatics algorithms.- static Function getPointsPerAngstrom(): returns the pixel/Ängstrom ratio that is currently defined by the default ChemDoodle settings
returns Number
Unit: pixels/Ängstrom
ChemDoodle.informatics.BondDeducer
is a class for analyzing bonds based on 3D coordinates- Number margin: the amount of flexibility in calculating bonds; the larger the number, the more bonds found
Default Value: 1.1
Unit: bond lengths - Function deduceCovalentBonds(Molecule molecule, Number customPointsPerAngstrom): deduces covalent bonds for the input molecule and appends them to the molecule's bonds array. Uses the covalent radii data provided in atomicData. The customPointsPerAngstrom parameters allows you to change the value from that specified by default.
ChemDoodle.informatics.HydrogenDeducer
is a class for manipulating hydrogens- Function removeHydrogens(Molecule molecule, Boolean removeStereo): removes all hydrogens and bonds attached to them from the given molecule; if removeStereo is not set to true, then hydrogens connected with wedge bonds are retained
ChemDoodle.informatics.Splitter
is a class for splitting a Molecule data structure composed of discrete graphs into individual discrete Molecule objects- Function split(Molecule molecule): returns an array consisting of each discrete graph data structure in the input molecule, as individual discrete Molecule objects
returns Array
ChemDoodle.informatics.StructureBuilder
is a class for copying and creating molecular structures- Function copy(Molecule molecule): returns a new Molecule object that is a copy of the input Molecule
returns Molecule
ChemDoodle.informatics._Counter
is an interface for calculating integer descriptors given a Molecule object. It should not be instantiated. To obtain a value from a Counter, use the following command where mol is a Molecule object and ChildOfCounter is a child of the Counter class: new ChildOfCounter(mol).value- Number value: the result of the Counter algorithm
- Molecule molecule: holds the Molecule object being analyzed by the child derivative
- Function setMolecule(Molecule molecule): sets the molecule and performs the descriptor calculation. Should be called as the last method in all child constructors.
- abstract Function innerCalculate(Molecule molecule): this method is defined by all child classes of Counter. This method should calculate the descriptor value given the Molecule stored.
ChemDoodle.informatics.FrerejacqueNumberCounter
is a child of the Counter class and calculates the Frèrejacque Number, which is the SSSR count.constructor = new Function FrerejacqueNumberCounter(Molecule molecule)
prototype = _Counter
- override Function innerCalculate(Molecule molecule): calculates the Frèrejacque Number. This should never be manually called as it is called by the constructor after setup.
ChemDoodle.informatics.NumberOfMoleculesCounter
is a child of the Counter class and calculates the real number of molecules in a Molecule object, which can hold disjoint graphs.constructor = new Function NumberOfMoleculesCounter(Molecule molecule)
prototype = _Counter
- override Function innerCalculate(Molecule molecule): calculates the number of molecules. This should never be manually called as it is called by the constructor after setup.
ChemDoodle.informatics._RingFinder
is an interface for ring perception algorithms. It should not be instantiated. Contains helper methods for ring perception and for storing rings. So to obtain a ring set, use the following command where mol is a Molecule object and ChildOfRingFinder is a child of the RingFinder class: new ChildOfRingFinder(mol).rings- Array atoms: all atoms that will be analyzed during ring perception are stored here, set by RingFinder.reduce()
- Array bonds: all bonds that will be analyzed during ring perception are stored here, set by RingFinder.reduce()
- Array rings: this array holds all the perceived rings
- Function fuse(): a helper method to find the bonds that belong to the perceived rings if only the atoms are specified.
- Function reduce(Molecule molecule): reduces this input molecule graph to discard most non-ring atons and all lone atoms to speed up runtimes, sets the atoms and bonds Arrays to the reduced graph.
- Function setMolecule(Molecule molecule): sets the molecule and performs the ring perception. Should be called as the last method in all child constructors.
- abstract Function innerGetRings(Molecule molecule): this method is defined by all child classes of RingFinder. This method should find rings based on the reduced atoms and bonds Arrays and then place perceived rings in the rings Array.
ChemDoodle.informatics.SSSRFinder
perceives the Smallest Set of Smallest Rings (SSSR) as defined by Plotkin. The SSSR set is not unique. This is not a child of the RingFinder class, as it uses the EulerFacetRingFinder class to perceive rings, and the SSSR is retrieved from that result. It works identically to a RingFinder derivative.constructor = new Function SSSRFinder(Molecule molecule)
- Array rings: this array holds all the perceived rings
ChemDoodle.informatics.EulerFacetFinder
is a child of the RingFinder class and perceives a set of rings that defines all Euler facets in a molecule using an algorithm developed by Kevin Theisen. This ring set is thorough, unique and adequately describes rings as a 3D representation of a 2D drawing.constructor = new Function EulerFacetFinder(Molecule molecule)
prototype = _RingFinder
- Number fingerBreak: is a cutoff for the size of rings to be found. Defines the length of a ring path which is half of a ring. So a value of 5 specifies that only 8 membered rings and smaller should be perceived. Use this setting to improve performance.
Default Value: 5 - override Function innerGetRings(Molecule molecule): implements the algorithm to find the Euler facet ring set. This should never be manually called as it is called by the constructor after setup.
ChemDoodle.io
this package contains various classes and tools for converting chemical data between formats.- static Function fromJSONDummy(Object content): recover a Molecule from JSON format
returns Molecule - static Function toJSONDummy(Molecule mol): convert a Molecule to a consise Object that represents the chemical data for use in JSON protocol
returns Object
ChemDoodle.io._Interpreter
is an interface for reading and writing chemical data. It should not be instantiated. Contains helper methods for dealing with data.- Function fit(String data, Number length, Boolean leftAlign): helper method for formating data in MDL-like syntaxes.
ChemDoodle.io.JSONInterpreter
handles converting Javascript objects to and from the ChemDoodle JSON format, this is NOT a child of the Interpreter classconstructor = new Function JSONInterpreter()
- Function contentFrom(Object dummy): given the input object represented in ChemDoodle JSON (object, not the string), this function will create the corresponding Object data structure containing an Array of Molecule data structures named molecules and an Array of Shape data structures named shapes
returns Object - Function contentTo(Array mols, Array shapes): creates a dummy object from the input molecules and shapes Arrays corresponding to the ChemDoodle JSON format; use JSON.stringify() to create a JSON string from this dummy object
returns Object - Function molFrom(Object dummy): given the input object represented in ChemDoodle JSON (object, not the string), this function will create the corresponding Molecule data structure
returns Molecule - Function molTo(Molecule mol): creates a dummy object from the input Molecule data structure corresponding to the ChemDoodle JSON format; use JSON.stringify() to create a JSON string from this dummy object
returns Object - Function queryFrom(Object dummy): given the input object represented in ChemDoodle JSON (object, not the string), this function will create the corresponding Query data structure
returns Query - Function queryTo(Molecule mol): creates a dummy object from the input Query data structure corresponding to the ChemDoodle JSON format; use JSON.stringify() to create a JSON string from this dummy object
returns Object - Function shapeFrom(Object dummy, Array mols): given the input object represented in ChemDoodle JSON (object, not the string), this function will create the corresponding Shape data structure; the second parameter is the array of molecules already read, just incase the shape is dependent upon them
returns _Shape - Function shapeTo(Molecule shape): creates a dummy object from the input Shape data structure corresponding to the ChemDoodle JSON format; use JSON.stringify() to create a JSON string from this dummy object
returns Object
ChemDoodle.io.JCAMPInterpreter
reads IUPAC JCAMP-DX files, is a child of the Interpreter classconstructor = new Function JCAMPInterpreter()
prototype = _Interpreter
- Boolean convertHZ2PPM: if true, and the file being read is a NMR spectrum in HZ, then the interpreter will automatically convert the x-axis into PPM
Default Value: false
Unit: true/false - Function makeStructureSpectrumSet(String id, String content): given an input JCAMP file with structure colleration data, this function creates two canvases, one for a molecule and one for the spectrum, where each has hover events (or touch on mobile) to highlight peaks and the corresponding parts of the molecular structure; the input id is used to generate the canvases, or find previously created canvases; the array that is returned contains the molecule ChemDoodle Web Component and the spectrum ChemDoodle Web Component objects in that order
returns Array - Function read(String content): reads the JCAMP file content and returns the corresponding Spectrum
returns Spectrum
ChemDoodle.io.MOLInterpreter
reads and writes MDL MOLFiles, both v2000 and v3000, is a child of the Interpreter classconstructor = new Function MOLInterpreter()
prototype = _Interpreter
- Number version: when writing V3000 MOLFiles by instantiating this class, first set this parameter to 3
Default Value: 2
Unit: version number - Function read(String content, Number multiplier): reads MOLFile content and returns the corresponding molecule; this function will automatically detect v2000 and v3000 MOLFiles and handle them accordingly; the optional multiplier variable will override the default_anstromsPerBondLength variable, set it to 1 for 3D scenes in Angstroms
returns Molecule - Function write(Molecule molecule): writes and returns a String containing the MOLFile of the given molecule
returns String
ChemDoodle.io.RXNInterpreter
reads and writes MDL RXNFiles (v2000), is a child of the Interpreter classconstructor = new Function RXNInterpreter()
prototype = _Interpreter
- Function read(String content, Number multiplier): reads RXNFile content and returns an object containing the corresponding content. The Object possesses an array of Molecules which an be accessed with the name 'molecules' and a shape array by the name of 'shapes' which contains only one Line data structure representing the arrow. The optional multiplier variable will override the default_anstromsPerBondLength variable, set it to 1 for 3D scenes in Angstroms
returns Object - Function write(Array molecules, Array shapes): writes and returns a String containing the RXNFile of the given molecules and shapes
returns String
ChemDoodle.io.XYZInterpreter
reads XYZ files, is a child of the Interpreter classconstructor = new Function XYZInterpreter()
prototype = _Interpreter
- Molecule deduceCovalentBonds: if true, the XYZInterpreter will also calculate covalent bonds for input atoms
Default Value: true
Unit: true/false - Function read(String content): reads XYZ file content and returns the corresponding molecule
returns Molecule
ChemDoodle.io.PDBInterpreter
reads RCSB PDB files, is a child of the Interpreter classconstructor = new Function PDBInterpreter()
prototype = _Interpreter
- Molecule deduceResidueBonds: if true, the PDBInterpreter deduce bonds between residue atoms
Default Value: false
Unit: true/false - Molecule calculateRibbonDistances: if true, the PDBInterpreter will also calculate distances for all protein and nucleic acid atoms to the closest ligand atoms for use in display. If no ligand atoms are present, then all atoms will be given a measured distance of 0
Default Value: false
Unit: true/false - Function read(String content, Number multiplier): reads the PDB file content and returns the corresponding Molecule; the optional multiplier variable will override the default_anstromsPerBondLength variable, set it to 1 for 3D scenes in Angstroms
returns Molecule
ChemDoodle.io.CIFInterpreter
reads Crystallographic Information Files (CIF), is a child of the Interpreter classconstructor = new Function CIFInterpreter()
prototype = _Interpreter
- static Function generateABC2XYZ(Number a: Angstroms, Number b: Angstroms, Number c: Angstroms, Number alpha: radians, Number beta: radians, Number gamma: radians): Given the lengths and angles of the unit cell, a matrix is calculated (represented in an Array) of the transform matrix from ABC coordinates to XYZ coordinates
returns Array - Function read(String content, Number xSuper, Number ySuper, Number zSuper): reads a CIF file and returns the corresponding Molecule and unit cell shape; the returned object will contain two parameters, molecule and unitCell; the three optional integers specify the supercell dimensions, by default they are all 1, so reading a file without specifying these parameters will produce just the unit cell. In addition to reading atoms from CIF files, this interpreter will also produce a unit cell and other objects relevant to the display of periodic information
returns Molecule
ChemDoodle.io.CMLInterpreter
reads Chemical Markup Language files, is a child of the Interpreter class. Currently supports molecules only, no reactions.constructor = new Function CMLInterpreter()
prototype = _Interpreter
- Function read(String content): reads CML content and returns an object containing the corresponding content. The Object possesses an array of Molecules which an be accessed with the name 'molecules'.
returns Object - Function write(Array
Unit: molecules): writes and returns a String containing the CML of the given molecules.
returns String
ChemDoodle.io.file
this package deals with files.- static Function content(String url, Function callback): retrieves the content of a file given an input url; the content is sent to the callback function provided; note that this function uses AJAX, so it will only work for files local to the same origin calling it, unless the server supports XHR2
ChemDoodle.io.png
this package generates Portable Network Grpahics (PNG) images from canvases.- static Function download(_Canvas canvas, String filename): creates a PNG image from the input Canvas object and downloads the file to the user's default download location. The name of the file is the second parameter, which will default to "unnamed" if not provided.
- static Function open(_Canvas canvas): creates a PNG image from the input Canvas object and opens it in a new window or tab based on the user's browser settings.
- static Function string(_Canvas canvas): creates a PNG image from the input Canvas object as a String and returns it; the String will be prepended with "data:image/png;base64,".
returns String
ChemDoodle.io.svg
this package generates Web Scalable Vector Graphics (SVG) images from canvases. This class can only generate SVGs for 2D Canvases. (Proprietary Only)- static Function download(_Canvas canvas, String filename): creates a SVG image from the input Canvas object and downloads the file to the user's default download location. The name of the file is the second parameter, which will default to "unnamed" if not provided.
- static Function open(_Canvas canvas): creates a SVG image from the input Canvas object and opens it in a new window or tab based on the user's browser settings.
- static Function string(_Canvas canvas): creates a SVG image from the input Canvas object as a String and returns it.
returns String
ChemDoodle.math
this package contains various methematical algorithms.- static Function angleBetweenLargest(Object data): returns an object with two parameters (angle, largest); angle points between the largest gap of the input Array of angles in radians, largest is the value of the angle between the bonds of the largest gap in radians
returns Number - static Function angleBounds(Number value, Boolean convertToDegrees, Boolean constrainToPi): this is a helper method to alter an angle in radians to be between 0 and 2pi and with an additional parameter to convert to degrees and a last parameter to constrain under Pi (so it will give the 2Pi complement)
returns Number - static Function calculateDistanceInterior(Point to, Point from, Object r): returns the distance of a line inscribed in a rectangle, given that the line has only 1 endpoint in the rectangle; the rectangle is a object with self-explanatory parameters x, y, w, and h
returns Number - static Function clamp(Number value, Number min, Number max): return the value if it is between the min and max, inclusive; returns the min if the value is less than the min, returns the max if the value is greater than the max
returns Number - static Function distanceFromPointToLineInclusive(Point p, Point l1, Point l2, Number retract): returns the shortest (tangent) distance from the input Point to the line with endpoints defined by the last two input Points. This works by rotating the frame such that the line starts at the origin and points up along the x-axis, and the absolute value of the rotated input Point x-coordinate is returned. If the input Point's y-coordinate is not between the endpoints, inclusively, a value of -1 is returned. The retract parameter is optional and will buffer the ends of the line from hitting with that magnitue if provided.
returns Number - static Function getRGB(String hex, Number mutliplier): returns a 3 membered Array of Numbers corresponding to the RGB magnitudes of the input hex string and multiplied by the input multiplier
returns Array - static Function hsl2rgb(Number h, Number s, Number l): convert HSL (values between 0 and 1) color to RGB values
returns Array - static Function idx2color(Number value): this is a helper method for our WebGL picking system
returns String - static Function intersectLines(Number x1, Number y1, Number x2, Number y2, Number x3, Number y3, Number x4, Number y4): returns the intersection of two non-parallel line segments, if they intersect
returns Point - static Function isBetween(Number x, Number left, Number right): returns true if the first input parameter is between the last two input parameters, inclusively
returns Boolean - static Function pointInPoly(Object poly, Point pt): return true if the Point pt is in Polygon poly
returns Boolean - static Function rainbowAt(Number i, Number ii, Array colors): returns an rgb color as a CSS string, this is a helper function for the rainbow coloring in ribbons
returns String
ChemDoodle.math.Bounds
manages 2D and 3D bounds information for graphical objectsconstructor = new Function Bounds()
- Number minX: the minimum X value for the rectangle that represents these bounds
Default Value: Infinity - Number minY: the minimum Y value for the rectangle that represents these bounds
Default Value: Infinity - Number maxX: the maximum X value for the rectangle that represents these bounds
Default Value: -Infinity - Number maxY: the maximum Y value for the rectangle that represents these bounds
Default Value: -Infinity - Number minZ: the minimum Z value for the rectangular prism that represents these bounds
Default Value: Infinity - Number maxZ: the maximum Z value for the rectangular prism that represents these bounds
Default Value: -Infinity - Function expand(Number x1, Number y1, Number x2, Number y2): this Bounds object will expand the bounds of the current rectangle using the x and y data provided; two sets of coordinates can be provided, but the second set is optional (this way you can expand by point or by rectangle)
- Function expand(Bounds bounds2): this Bounds object will expand the bounds of the current rectangle (or rectangular prism, if z coordinate information is provided) using the Bounds data provided by the bounds2 parameter
- Function expand3D(Number x1, Number y1, Number x2, Number y2, Number z1, Number z2): this Bounds object will expand the bounds of the current rectangular prisms using the x, y and z data provided; two sets of coordinates can be provided, but the second set is optional (this way you can expand by point or by rectanglular prism)
ChemDoodle.monitor
this package keeps track of user input on the current page, such as the Canvas that is focused and what modifier keys are pressed on the keyboard- static Boolean SHIFT: keeps track of whether the shift key is held down
- static Boolean ALT: keeps track of whether the alt key is held down
- static Boolean META: keeps track of whether the operating system specific meta key is held down (CTRL on Windows/Linux, CMD on Mac)
- static _Canvas CANVAS_OVER: keeps track of the canvas that the mouse is currently over. This is undefined if the mouse is over no canvas
- static _Canvas CANVAS_DRAGGING: keeps track of the canvas that the mouse is currently dragging from. This is undefined if no Canvas is currently being dragged from
ChemDoodle.structures
this package hosts all data structures provided by the ChemDoodle Web Components library.ChemDoodle.structures.Element
is data structure for holding information about an element. This is a private class that cannot be instantiated, however, the Elements in the ELEMENT array can be extended.constructor = new Function Element(String symbol, String name, Number atomicNumber)
- String symbol: the symbol of the element
- String name: the name of the element
- Number atomicNumber: the atomic number of the element
- Boolean addH: if true, implicit hydrogens are added to this element
- Number covalentRadius: the covalent radius of the element
- Number vdWRadius: the van der Waals radius of the element
- String jmolColor: the Jmol color of the element
- String pymolColor: the PyMOL color of the element; all colors are the same as the Jmol set except: H, C, N, O, F, S
- Number mass: the integer value for the mass of the most abundant isotope of the element
- Number valency: the maximum valency for an element, or 0 if unknown
ChemDoodle.structures.Residue
is data structure for holding information about residue types. This is a private class that cannot be instantiated, however, the Residues in the RESIDUE array can be extended.constructor = new Function Residue(String symbol, String name, Number atomicNumber)
- String symbol: the symbol of the residue
- String name: the name of the residue
- Boolean polar: just for amino acids, true if polar, false if non-polar
- String aminoColor: the color of the residue in the "amino" color set
- String shapelyColor: the color of the residue in the "shapely" color set
- Number acidity: the acidity of the residue, -1 for acidic, 0 for neutral, 1 for basic
ChemDoodle.structures.PeriodicCell
is data structure for holding information about a single cell in the periodic table for the PeriodicTableCanvas. This is a private class that cannot be instantiated.constructor = new Function PeriodicCell(Element element, Number x, Number y, Number dimension)
- Element element: the corresponding element
- Number x: the x coordinate of the top-left corner of the cell
- Number y: the y coordinate of the top-left corner of the cell
- Number dimension: the width and height of the square cell
ChemDoodle.structures.Styles
The Styles structure contains all the variables that define how all objects are drawn on the canvas. The style variables are categorized based on the objects they modify and the names of those variables are prepended with the category. For instance, spectrum settings all begin with the "plots_" prepend. All of these styles are set by the defaults when a Canvas is constructed. The default variables are defined by the global ChemDoodle.DEFAULT_STYLES, which an object containing all the defined styles. Change the default settings to enforce a style sheet on an entire webpage. You can create a copy of a Styles object by sending in the instance to be copied into the Styles constructor; of course, if nothing is provided into the constructor, the default styles are used.constructor = new Function Styles(Styles copy)
- //Canvas Specifications
- String backgroundColor: background color of the canvas, set this to undefined to create a see-through canvas
Default Value: white
Unit: color - Number scale: scale of the canvas, set this after the molecule has been loaded, then repaint the canvas
Default Value: 1
Unit: %/100 - Number rotateAngle: rotation angle of the canvas
Default Value: 0
Unit: radians - Number bondLength_2D: length of the bonds, set the default_ before using an interpreter to read your file; for 2D depiction
Default Value: 20
Unit: pixels - Number angstromsPerBondLength: number of Angstroms per bond length
Default Value: 1.25
Unit: Å/bond length - Array lightDirection_3D: the direction the lighting points in 3D scenes
Default Value: [-.1, -.1, -1]
Unit: vector - String lightDiffuseColor_3D: the diffusive light color in 3D scenes
Default Value: '#FFFFFF'
Unit: color - String lightSpecularColor_3D: the specular light color in 3D scenes
Default Value: '#FFFFFF'
Unit: color - Boolean projectionPerspective_3D: if true, a perspective projection will be used, if false, an orthographic projection will be used
Default Value: true
Unit: true/false - Number projectionPerspectiveVerticalFieldOfView_3D: the field of view angle for the perspective projection matrix in 3D scenes
Default Value: 45
Unit: degrees - Number projectionOrthoWidth_3D: the width of the orthographic projection matrix in 3D scenes
Default Value: 40
Unit: Angstroms - Number projectionWidthHeightRatio_3D: the width/height ratio for the projection matrix in 3D scenes; this setting is automatically handled by the canvas given its dimensions, but can be overridden if preferred (if the value is undefined, then this setting is ignored), this should be width/height of your canvas to keep the aspect ratio square
Unit: ratio - Number projectionFrontCulling_3D: the near camera cutoff distance in 3D scenes
Default Value: 0.1
Unit: Angstroms - Number projectionBackCulling_3D: the far camera cutoff distance in 3D scenes
Default Value: 10000
Unit: Angstroms - Boolean cullBackFace_3D: if true, enables the rendering optimization not to render the mesh polygons facing away from the camera
Default Value: true
Unit: true/false - Number fog_mode_3D: this number defines the fogging algorithm used during the rendering of 3D scenes; 0 - No Fogging, 1 - Linear, 2 - EXP, 3 - EXP^2
Allowed Values: [0, 1, 2, 3]
Default Value: 0 - String fog_color_3D: the fog color
Default Value: #000000
Unit: color - Number fog_start_3D: the clip to start fogging along the objects
Default Value: 0
Unit: %/100 - Number fog_end_3D: the clip to end fogging along the objects
Default Value: 1
Unit: %/100 - Number fog_density_3D: this number affects the fogging algorithms in different ways, but it related to the magnitude
Default Value: 1 - Boolean shadow_3D: if true, render a cast shadow to the scene
Default Value: false
Unit: true/false - Number shadow_intensity_3D: This number, between 0-1, defines the intensity of the shadow, with 0 not shading anything and 1 completely shading covered geometry to black
Default Value: 0.85 - Boolean flat_color_3D: if true, renders the scene using a flat color for each object (essentially no first pass shading)
Default Value: false
Unit: true/false - Boolean antialias_3D: if true, enables software antialiasing (which is not as good as hardware antialiasing); this is useful when using deferred shading techniques
Default Value: true
Unit: true/false - Number gammaCorrection_3D: defines the gamma correction value for rendering 3D scenes
Default Value: 2.2 - String colorHover: the hover color used for graphics
Default Value: #885110
Unit: color - String colorSelect: the select color used for graphics
Default Value: #0060B2
Unit: color - String colorError: the error color used for graphics
Default Value: #C10000
Unit: color - String colorPreview: the preview color used for graphics
Default Value: #00FF00
Unit: color - //3D Shader Specifications
- Boolean ssao_3D: enable screen space ambient occlusion (SSAO)
Default Value: false
Unit: true/false - Number ssao_kernel_radius: kernel radius setting for the SSAO shader
Default Value: 17
Unit: - Number ssao_kernel_samples: the number of kernel samples to use, must be an integer
Default Value: 32
Unit: positive integer - Number ssao_power: power setting for the SSAO shader
Default Value: 1
Unit: - Boolean outline_3D: enable outlining
Default Value: false
Unit: true/false - Number outline_thickness: thickness setting for the outline shader
Default Value: 1
Unit: - Number outline_normal_threshold: normal threshold setting for the outline shader
Default Value: 0.85
Unit: - Number outline_depth_threshold: depth threshold setting for the outline shader
Default Value: 0.1
Unit: - Number fxaa_edgeThreshold: depth threshold setting for the FXAA antialiasing shader
Default Value: 0.0625
Unit: - Number fxaa_edgeThresholdMin: depth threshold setting for the FXAA antialiasing shader
Default Value: 0.08333333333333333
Unit: - Number fxaa_searchSteps: the number of search steps to perform for the FXAA antialiasing shader
Default Value: 64
Unit: positive integer - Number fxaa_searchThreshold: serch threshold setting for the FXAA antialiasing shader
Default Value: 0.25
Unit: - Number fxaa_subpixCap: subpixel cap setting for the FXAA antialiasing shader
Default Value: 1
Unit: - Number fxaa_subpixTrim: subpixel trim setting for the FXAA antialiasing shader
Default Value: 0
Unit: - //Atom Specifications
- Boolean atoms_display: draw the atoms
Default Value: true
Unit: true/false - String atoms_color: atom color
Default Value: #000000
Unit: color - Number atoms_font_size_2D: atom text font size for 2D depiction
Default Value: 12
Unit: points - Array atoms_font_families_2D: the atom text font families, families cascade through the array if not found on the users computer; for 2D depiction
Default Value: [Helvetica, Arial, Dialog]
Unit: Array<String> - Boolean atoms_font_bold_2D: atom text will be bold
Default Value: false
Unit: true/false - Boolean atoms_font_italic_2D: atom text will be italicized
Default Value: false
Unit: true/false - Boolean atoms_circles_2D: draw atoms as circles, text is not drawn; for 2D depiction
Default Value: false
Unit: true/false - Number atoms_circleDiameter_2D: diameter of atom circles for 2D depiction
Default Value: 10
Unit: pixels - Number atoms_circleBorderWidth_2D: width of atom circle borders for 2D depiction
Default Value: 1
Unit: pixels - Boolean atoms_useJMOLColors: use Jmol colors for atoms
Default Value: false
Unit: true/false - Boolean atoms_usePYMOLColors: use PyMOL colors for atoms, will default to Jmol if that specification is also true
Default Value: false
Unit: true/false - Boolean atoms_HBlack_2D: render hydrogen atoms as black always in 2D canvases if this setting is true, irregardless of other color settings; this is useful when showing color sets in both 2D and 3D components on the same page
Default Value: true
Unit: true/false - Boolean atoms_implicitHydrogens_2D: render implicit hydrogens on all labels that are visible
Default Value: true
Unit: true/false - Boolean atoms_displayTerminalCarbonLabels_2D: show labels for terminal carbons
Default Value: false
Unit: true/false - Boolean atoms_showHiddenCarbons_2D: show hidden carbons that are located between two nearly parallel bonds of the same bond order
Default Value: true
Unit: true/false - Boolean atoms_showAttributedCarbons_2D: show carbon labels for carbon atoms with an attribute (charge, radical, lone pair) associated
Default Value: true
Unit: true/false - Boolean atoms_displayAllCarbonLabels_2D: show all carbon labels
Default Value: false
Unit: true/false - Number atoms_lonePairDistance_2D: distance between the lone pairs and the atom
Default Value: 8
Unit: pixels - Number atoms_lonePairSpread_2D: distance between the electrons in lone pairs
Default Value: 4
Unit: pixels - Number atoms_lonePairDiameter_2D: diameter of the dots representing electrons in lone pairs
Default Value: 1
Unit: pixels - Number atoms_resolution_3D: the resolution of the sphere vertex buffer used to render atoms in 3D scenes
Default Value: 30
Unit: positive integer - Number atoms_sphereDiameter_3D: the diameter of atoms in 3D scenes (for ball and stick and wireframe type representations); atoms_useVDWDiameters_3D overrides this property
Default Value: 0.8
Unit: Angstroms - Boolean atoms_useVDWDiameters_3D: use van der Waals diameters for atoms
Default Value: false
Unit: true/false - Number atoms_vdwMultiplier_3D: a multiplier for VDW radii
Default Value: 1
Unit: %/100 - String atoms_materialAmbientColor_3D: the ambient color for atoms in 3D scenes
Default Value: #000000
Unit: color - String atoms_materialSpecularColor_3D: the specular color for atoms in 3D scenes
Default Value: #555555
Unit: color - Number atoms_materialShininess_3D: the shininess of atoms in 3D scenes
Default Value: 32
Unit: positive integer - Boolean atoms_nonBondedAsStars_3D: display non-bonded atoms using a star geometry, good for visualizing ions or water oxygens in PDB files
Default Value: false
Unit: true/false - Boolean atoms_displayLabels_3D: display atom labels in WebGL components
Default Value: false
Unit: true/false - //Bond Specifications
- Boolean bonds_display: draw the bonds
Default Value: true
Unit: true/false - String bonds_color: bond color
Default Value: #000000
Unit: color - Number bonds_width_2D: width of the bonds for 2D depiction; also controls the width of primitive lines for bonds rendered in WebGL scenes
Default Value: 1
Unit: pixels - Boolean bonds_useAbsoluteSaturationWidths_2D: use absolute widths for saturation spacing if true; if false, use the relative value
Default Value: true
Unit: true/false - Number bonds_saturationWidth_2D: relative saturation width of double and triple bond lines for 2D depiction
Default Value: 0.2
Unit: %/100*bondLength - Number bonds_saturationWidthAbs_2D: absolute saturation width of double and triple bond lines for 2D depiction
Default Value: 5
Unit: pixels - String bonds_ends_2D: bond end style for 2D depiction
Allowed Values: [butt, round, square]
Default Value: round - Boolean bonds_splitColor: color the bond in half based on the colors of the connected atoms; in 2D the type of fill is controlled by the bonds_colorGradient specification
Default Value: false
Unit: true/false - Boolean bonds_colorGradient: color the bond by using a gradient between the two colors of the constituent atoms, rather than by using a color split
Default Value: false
Unit: true/false - Number bonds_saturationAngle_2D: the angle that saturated double bonds are clipped by for 2D depiction
Default Value: Math.PI/3
Unit: radians - Boolean bonds_symmetrical_2D: double bonds are drawn symmetrically always, instead of pointing towards the center of a ring, for instance; for 2D depiction
Default Value: false
Unit: true/false - Boolean bonds_clearOverlaps_2D: draws a small background to the bond in the background color to contrast between overlapping bonds for 2D depiction
Default Value: false
Unit: true/false - Number bonds_overlapClearWidth_2D: the extent of the overlap clearing in both directions for 2D depiction
Default Value: 0.5
Unit: pixels - Number bonds_atomLabelBuffer_2D: the amount that the bond pulls back from atom text for 2D depiction
Default Value: 1
Unit: pixels - Number bonds_wedgeThickness_2D: the thickness of stereochemical wedge bonds for 2D depiction
Default Value: 6
Unit: pixels - Number bonds_wavyLength_2D: the amplitude of wavy bonds for 2D depiction
Default Value: 4
Unit: pixels - Number bonds_hashWidth_2D: the width of hashes for 2D depiction
Default Value: 1
Unit: pixels - Number bonds_hashSpacing_2D: the spacing of hashes for 2D depiction
Default Value: 2.5
Unit: pixels - Number bonds_dotSize_2D: the diameter of dots used in bond rendering (usually for zero order bonds)
Default Value: 2
Unit: pixels - Boolean bonds_lewisStyle_2D: this setting controls how whole order bonds are rendered; bonds will be renedered in Lewis Dot style, with perpendicular electron pairs representing the bonds
Default Value: false
Unit: true/false - Boolean bonds_showBondOrders_3D: renders higher bond orders with multiple cylinders if true, higher bond orders will orient themselves to face the camera
Default Value: false
Unit: true/false - Number bonds_resolution_3D: the resolution of the cylinder vertex buffer used to render bonds in 3D scenes
Default Value: 30
Unit: positive integer - Boolean bonds_renderAsLines_3D: renders bonds as primitive lines in WebGL scenes, instead of as meshes
Default Value: false
Unit: true/false - Number bonds_cylinderDiameter_3D: the diameter of bonds in 3D scenes
Default Value: 0.3
Unit: Angstroms - Number bonds_pillLatitudeResolution_3D: the latitude resolution of the pill vertex buffer used to render bonds in 3D scenes
Default Value: 10
Unit: positive integer - Number bonds_pillLongitudeResolution_3D: the longitude resolution of the pill vertex buffer used to render bonds in 3D scenes
Default Value: 20
Unit: positive integer - Number bonds_pillHeight_3D: the length of hash segments of hash bonds in 3D scenes
Default Value: 0.3
Unit: Angstroms - Number bonds_pillSpacing_3D: the spacing of hash bonds in 3D scenes
Default Value: 0.1
Unit: Angstroms - Number bonds_pillDiameter_3D: the diameter of hash bonds in 3D scenes
Default Value: 0.3
Unit: Angstroms - String bonds_materialAmbientColor_3D: the ambient color for bonds in 3D scenes
Default Value: #000000
Unit: color - String bonds_materialSpecularColor_3D: the specular color for bonds in 3D scenes
Default Value: #555555
Unit: color - Number bonds_materialShininess_3D: the shininess of bonds in 3D scenes
Default Value: 32
Unit: positive integer - //Macromolecule Specifications
- Boolean proteins_displayRibbon: render ribbons for proteins, if any
Default Value: true
Unit: true/false - Boolean proteins_displayBackbone: render a stick trace along the alpha carbon backbone for proteins, if any
Default Value: false
Unit: true/false - Boolean proteins_displayPipePlank: render a pipe and plank model for proteins, if any
Default Value: false
Unit: true/false - Number proteins_backboneThickness: the thickness of the sticks used to render the alpha carbon backbone
Default Value: 1.5
Unit: Angstroms - String proteins_backboneColor: the color of the alpha carbon backbone trace
Default Value: #CCCCCC
Unit: color - Boolean proteins_ribbonCartoonize: display a cartoon version of the ribbons for proteins; by default ribbons and their edges are continuous, by using the cartoon model, ribbon edges will be constant widths for different parts of the structure and will jump at intersections, end of helices and sheets will render an arrowhead
Default Value: false
Unit: true/false - String proteins_residueColor: color residues by segment when set; by default this is 'none', and residues will not be individually colored
Allowed Values: [none, amino, shapely, polarity - color amino acids by polar(red)/non-polar(white), acidity - color amino acids by acidic(red)/basic(blue)/neutral polar(white)/neutral non-polar(brown), rainbow]
Default Value: none - String proteins_primaryColor: the color of the front of the ribbon
Default Value: #FF0D0D
Unit: color - String proteins_secondaryColor: the color of the back of the ribbon' ticks
Default Value: #FFFF30
Unit: color - String proteins_ribbonCartoonHelixPrimaryColor: the color of the front of helices in cartoon models
Default Value: #00E740
Unit: color - String proteins_ribbonCartoonHelixSecondaryColor: the color of the back of helices in cartoon models
Default Value: #9905FF
Unit: color - String proteins_ribbonCartoonSheetColor: the color of sheets in cartoon models
Default Value: #E8BB99
Unit: color - String proteins_tubeColor: the color of the tubes for pipe and plank protein models
Default Value: #FF0D0D
Unit: color - Number proteins_tubeResolution_3D: the resolution of the tube used for pipe and plank protein models in 3D scenes
Default Value: 15
Unit: positive integer - Number proteins_ribbonThickness: the thickness of the mesh for the ribbon
Default Value: 0.2
Unit: Angstroms - Number proteins_tubeThickness: the thickness of tube meshes built for the pipe and plank models
Default Value: 0.5
Unit: Angstroms - Number proteins_plankSheetWidth: the thickness of the sheet planks built for the pipe and plank models
Default Value: 3.5
Unit: Angstroms - Number proteins_cylinderHelixDiameter: the diameter of the helix cylinders built for the pipe and plank models
Default Value: 4
Unit: Angstroms - Number proteins_verticalResolution: the vertical resolution of ribbon models, must be a positive integer; recommended 8 for hi, 6 for med, 3 for low
Default Value: 8
Unit: divisions - Number proteins_horizontalResolution: the horizontal resolution of ribbon models, must be a positive odd integer; recommended 8 for hi, 5 for med, 3 for low
Default Value: 8
Unit: divisions - String proteins_materialAmbientColor_3D: the ambient color for ribbons in 3D scenes
Default Value: #000000
Unit: color - String proteins_materialSpecularColor_3D: the specular color for ribbons in 3D scenes
Default Value: #555555
Unit: color - Number proteins_materialShininess_3D: the shininess of ribbons in 3D scenes
Default Value: 32
Unit: positive integer - Boolean nucleics_display: render tubes and platforms for nucleic acids, if any
Default Value: true
Unit: true/false - String nucleics_tubeColor: the color of the tubes and base handles for the nucleic acid models
Default Value: #CCCCCC
Unit: color - String nucleics_baseColor: the color of the base platforms for the nucleic acid models
Default Value: #C10000
Unit: color - String nucleics_residueColor: color residues by segment when set; by default this is 'none', and residues will not be individually colored
Allowed Values: [none, shapely, rainbow]
Default Value: none - Number nucleics_tubeThickness: the thickness of the tubes that define the backbones of the nucleic acids
Default Value: 1.5
Unit: Angstroms - Number nucleics_tubeResolution_3D: the resolution of the tube used for the backbones of nucleic acids in 3D scenes
Default Value: 15
Unit: positive integer - Number nucleics_verticalResolution: the vertical resolution of nucleic models, must be a positive integer; recommended 8 for hi, 6 for med, 3 for low
Default Value: 8
Unit: divisions - String nucleics_materialAmbientColor_3D: the ambient color for nucleic acid models in 3D scenes
Default Value: #000000
Unit: color - String nucleics_materialSpecularColor_3D: the specular color for nucleic acid models in 3D scenes
Default Value: #555555
Unit: color - Number nucleics_materialShininess_3D: the shininess of nucleic acid models in 3D scenes
Default Value: 32
Unit: positive integer - Boolean macro_displayAtoms: render the atoms of the proteins and nucleic acids macromolecules, if any
Default Value: false
Unit: true/false - Boolean macro_displayBonds: render the bonds of the proteins and nucleic acids macromolecules, if any
Default Value: false
Unit: true/false - Number macro_atomToLigandDistance: this is the cutoff distance that will determine the distance from ligand molecules that is required to show macromolecule atoms; if no ligands are present, or if there are no distances calculated, this specification will have no effect; the PDBInterpreter must be set to calculate distances; if this value is -1, then all atoms are shown regardless of distance
Default Value: -1
Unit: Angstroms - Boolean macro_showWater: render water molecules, if any
Default Value: false
Unit: true/false - Boolean macro_colorByChain: color each individual chain with a unique color, overriding any other coloring specifications; colors are iterated in order, through HSL space
Default Value: false
Unit: true/false - Array macro_rainbowColors: the colors to interpolate through for the rainbow
Default Value: [#0000FF, #00FFFF, #00FF00, #FFFF00, #FF0000]
Unit: Array<String> - //Surface Specifications
- Boolean surfaces_display: render surfaces, if any
Default Value: true
Unit: true/false - Number surfaces_alpha: the transparency of surfaces in 3D scenes; a value between 0 and 1, with 0 being invisible and 1 being opaque
Default Value: 0.5
Unit: 0-1 - String surfaces_style: the surface rendering style
Allowed Values: [Dots, Mesh, Solid]
Default Value: Solid - String surfaces_color: the color of the surface
Default Value: white
Unit: color - String surfaces_materialAmbientColor_3D: the ambient color for surfaces in 3D scenes
Default Value: #000000
Unit: color - String surfaces_materialSpecularColor_3D: the specular color for surfaces in 3D scenes
Default Value: #000000
Unit: color - Number surfaces_materialShininess_3D: the shininess of surfaces in 3D scenes
Default Value: 32
Unit: positive integer - //Spectrum Specifications
- String plots_color: plot color
Default Value: #000000
Unit: color - Number plots_width: width of the plot line
Default Value: 1
Unit: pixels - Boolean plots_showIntegration: display an integration line, typically for NMR spectra
Default Value: false
Unit: true/false - String plots_integrationColor: integration line color
Default Value: #c10000
Unit: color - Number plots_integrationLineWidth: width of the integration line
Default Value: 1
Unit: pixels - Boolean plots_showGrid: display an grid using the axes' ticks
Default Value: false
Unit: true/false - String plots_gridColor: integration line color
Default Value: gray
Unit: color - Number plots_gridLineWidth: width of the integration line
Default Value: 0.5
Unit: pixels - Boolean plots_showYAxis: display the y-axis
Default Value: true
Unit: true/false - Boolean plots_flipXAxis: flip the x-axis, typical for certain domain units of NMR and IR spectra
Default Value: false
Unit: true/false - //Shape Specifications
- Number text_font_size: shape text font size
Default Value: 12
Unit: points - Array text_font_families: the shape text font families, families cascade through the array if not found on the users computer
Default Value: [Helvetica, Arial, Dialog]
Unit: Array<String> - Boolean text_font_bold: shape text will be bold
Default Value: false
Unit: true/false - Boolean text_font_italic: shape text will be italic
Default Value: false
Unit: true/false - Boolean text_font_stroke_3D: this specification determines whether labels in WebGL scenes will have a black stroke behind them to improve contrast in complex graphics
Default Value: true
Unit: true/false - String text_color: shape text color
Default Value: #000000
Unit: color - String shapes_color: shape color
Default Value: #000000
Unit: color - Number shapes_lineWidth: shape line width
Default Value: 1
Unit: pixels - Number shapes_pointSize: shape point size, typically for 3D rendering (as in surface dot representations)
Default Value: 2
Unit: pixels - Number shapes_arrowLength_2D: length of any associated arrows
Default Value: 8
Unit: pixels - Boolean compass_display: this specification determines whether the compass is displayed at the bottom-left of WebGL scenes
Default Value: false
Unit: true/false - String compass_axisXColor_3D: compass X arrow color
Default Value: #FF0000
Unit: color - String compass_axisYColor_3D: compass Y arrow color
Default Value: #00FF00
Unit: color - String compass_axisZColor_3D: compass Z arrow color
Default Value: #0000FF
Unit: color - Number compass_size_3D: The size of the compass
Default Value: 50
Unit: positive integer - Number compass_resolution_3D: The resolution of the compass
Default Value: 10
Unit: positive integer - Boolean compass_displayText_3D: If true, the compass will display labels for the axes (X,Y,Z)
Default Value: true
Unit: true/false - Number compass_type_3D: the type of compass to be rendered: 0 - bottom left mesh; 1 - center lined strokes
Allowed Values: [0, 1]
Default Value: 0
Unit: pixels - Boolean measurement_update_3D: Set this to true to have measurements update on repaint, for dynamic scenes; leave it false for static scenes to improve performance
Default Value: false
Unit: true/false - Number measurement_angleBands_3D: The resolution of the angle arcs for measurements
Default Value: 10
Unit: positive integer - Boolean measurement_displayText_3D: If true, text will display the measurement values
Default Value: true
Unit: true/false - Function copy(): create a copy of this Styles object
- Function set3DRepresentation(String representation): presets the 3D representation for the main molecular structure for a Canvas3D, currently accepts: 'Ball and Stick', 'van der Waals Spheres', 'Stick', 'Wireframe', 'Line'
ChemDoodle.structures.Point
represents a 2D point and contains functions for various 2D geometric calculationsconstructor = new Function Point(Number x, Number y)
- Number x: x coordinate
Default Value: 0
Unit: pixels - Number y: y coordinate
Default Value: 0
Unit: pixels - Function add(Point p): add Point p
- Function angle(Point p): returns the angle to Point p, with the current Point as the origin (y-axis is inverted for the inverted canvases)
returns Number
Unit: radians - Function angleForStupidCanvasArcs(Point p): same as angle(), but for the contradictory way canvas arcs are handled
returns Number
Unit: radians - Function distance(Point p): returns the distance to Point p
returns Number
Unit: pixels - Function sub(Point p): subtract Point p
ChemDoodle.structures.Query
this data structure holds query information for chemical objects; range type query variables are arrays filled with objects defining x and y parameters, for a single value range parameter, only x is definedconstructor = new Function Query(Number type)
- static String TYPE_ATOM: specifies an atom query
- static String TYPE_BOND: specifies a bond query
- String cache: this stores the current value of the query as a String; caching improves rendering performance, make sure to reset the cache if you change the Query by setting it to the output of the toString() function
- Array elements: this array contains values for the element identity variable, including generics
- Array charge: this array contains values for the atom charge variable, which is a range variable
- String chirality: this hash variable defines the stereochemical configuration of the atom
Allowed Values: [A, R, S] - Array connectivity: this array contains values for the atom connectivity variable (all connections including hydrogen), which is a range variable
- Array connectivityNoH: this array contains values for the atom connectivityNoH variable (all connections excluding hydrogen), which is a range variable
- Array hydrogens: this array contains values for the atom hydrogen count variable, which is a range variable
- Boolean hydrogens: this boolean variable defines whether an atom is saturated or not
- Array orders: this array contains values for the bond type identity variable, including generics
- String stereo: this hash variable defines the stereochemical configuration of the bond
Allowed Values: [A, E, Z] - Boolean aromatic: this boolean variable defines whether an object is aromatic or not
- Array ringCount: this array contains values for the object ring count variable, which is a range variable
- Number type: this type specifies the query context; defined with the static members of this class
- String stereo: stereochemical bias of the bond, must be one of the BOND_STEREO constants
Default Value: BOND_STEREO_NONE - Function draw(Context ctx, Styles styles, Point pos): draws this query to the canvas that owns the Context using the given Styles at the input position
- Function outputRange(Array range): returns a string representing the input range objects
returns String - Function parseRange(String value): returns an array of range values corresponding to the input string value
returns Array - Function toString(): returns a string representing this query in the ChemDoodle query notation format
returns String
ChemDoodle.structures.Atom
represents a chemical atomconstructor = new Function Atom(String label, Number x, Number y, Number z)
prototype = Point
- static String ESTEREO_ABSOLUTE: specifies 'abs' (absolute) enhanced stereochemistry
- static String ESTEREO_OR: specifies 'or' (or) enhanced stereochemistry
- static String ESTEREO_AND: specifies '&' (and) enhanced stereochemistry
- String label: label of the atom, should be an element symbol; this field is chemically significant and will be expected to be an element symbol
Default Value: C
Unit: Element Symbol - String altLabel: alternate text to be displayed for an atom, which will override the rendering of the element symbol and any associated attributes; this field is ignored if undefined
Default Value: undefined - Number z: z coordinate
Default Value: 0
Unit: pixels - Number charge: atomic charge
Default Value: 0 - Number mass: mass number, values greater than -1 are rendered
Default Value: -1 - Number implicitH: implicit hydrogen count override, this overrides the built in implicit hydrogen algorithm with the positive value (or 0) provided, values greater than -1 are rendered
Default Value: -1 - Number numLonePair: number of lone pairs to be rendered on an atom; this is a positive integer value
Default Value: 0 - Number numRadical: number of radical electrons to be rendered on an atom; this is a positive integer value
Default Value: 0 - Boolean isLone: not connected to any other atoms (if Carbon, draws a grey dot)
- Boolean isHover: if true, this represents that the mouse is hovered, draws a brown circle
- Boolean isSelected: if true, this represents that this atom is selected, draws a blue circle
- Boolean isOverlap: for SketcherCanvas, overlaps another atom, draws a red circle
- Boolean isLassoed: for SketcherCanvas, this atom is contained in the lasso
- Boolean isHidden: metadata set by the containing Molecule, states if the Atom is hidden (it is located between two parallel bonds, think allenes)
- Number coordinationNumber: metadata set by the containing Molecule, the valency of the Atom
- Number bondNumber: metadata set by the containing Molecule, the number of bonds connected to the Atom
- Number angleOfLeastInterference: metadata set by the containing Molecule, the angle in radians that points towards the largest open space between the bonds connected to the atom
- Array angles: metadata set by the containing Molecule, an Array of Number storing the bond angle information from this atom
- Boolean dontDraw: set this to true to not draw this atom, this is used by the sketcher to hide the label when using the text input tool
- Query query: this object stores the query information for this atom; if it is undefined, then there is no query associated with this atom
Default Value: undefined - Point molCenter: metadata set by the containing Molecule, the center of the molecule that contains this atom
- Object enhancedStereo: the enhanced stereochemistry definition for the atom; this object has two parameters, 'type' and 'group'. 'type' is a String and defines the enhanced stereochemistry operator, either 'abs', 'or', or '&', 'abs' by default. 'group' is a positive integer defining the and/or operator group and is 1 by default.
Default Value: {type:'abs', group:1} - Function add3D(Atom a): the 3D counterpart to the same Point function
- Function distance3D(Atom a): the 3D counterpart to the same Point function
- Function draw(Context ctx, Styles styles): draws this atom to the canvas that owns the Context using the given Styles
- Function drawAttribute(Context ctx, Styles styles): draws attributes for an Atom
- Function drawDecorations(Context ctx, Styles styles): draws decorations for the SketcherCanvas that owns the Context and has this Atom hovered
- Function getBounds(): returns a Bounds object containing the 2D bounds of the graphical atom
returns Bounds - Function getBounds3D(): returns a Bounds object containing the 3D bounds of the graphical atom
returns Bounds - Function getElementColor(Boolean useJMOLColors, Boolean usePYMOLColors, String color): this is a helper function for the rendering functions; given the input choices, a color is returned with which to render the atom with
returns String - Function getImplicitHydrogenCount(): returns the number of implicit hydrogens
returns Number - Function isLabelVisible(Styles styles): returns true if label is not 'C'
returns Boolean
Unit: true/false - Function render(GLContext gl, Styles styles, Boolean noColor): renders this atom to the 3D scene in the WebGL canvas that owns the GLContext using the given Styles; noColor is a parameter only used by the picking system
- Function renderHighlight(GLContext gl, Styles styles): renders the highlight for this atom the given Styles
- Function sub3D(Atom a): the 3D counterpart to the same Point function
ChemDoodle.structures.CondensedLabel
represents and renders advanced chemical labels, with correct tokenizing, formatting and layout. (Proprietary Only)constructor = new Function CondensedLabel(Atom atom, String text)
prototype = Point
- static Array ABBREVIATIONS: a string array of the valid and acceptable abbreviations to be used along with element symbols when parsing labels.
- Atom atom: the atom that this condensed label is labelling.
- String text: the text of the label to be parsed.
- Array tokens: a string array of the parsed tokens of the label.
- Function draw(Context ctx, Styles styles): draws this condensed label to the canvas that owns the Context using the given Styles
- Function getLeftAlignedTokens(Context ctx, Styles styles): reverses the order of the tokens if necessary for layout
returns Array
Unit: Array - Function parse(): this algorithm parses the label
ChemDoodle.structures.Ring
represents a chemical ringconstructor = new Function Ring()
- Array atoms: constituent atoms
- Array bonds: constituent bonds
- Point center: the center of this Ring, cached for performance
- Function getCenter(): returns a Point that specifies the center of this Ring
returns Point
Unit: pixels - Function setupBonds(Point p): loops through bonds and sets all Bond.ring objects in to itself, caches center
ChemDoodle.structures.Bond
represents a chemical bondconstructor = new Function Bond(Atom a1, Atom a2, Number bondOrder)
- static String STEREO_NONE: specifies no stereochemistry
- static String STEREO_PROTRUDING: specifies a protruding stereochemistry
- static String STEREO_RECESSED: specifies a recessed stereochemistry
- static String STEREO_AMBIGUOUS: specifies an ambiguous stereochemistry
- Atom a1: first Atom
- Atom a2: second Atom
- Number bondOrder: bond order
Allowed Values: [0.0, 0.5, 1.0, 1.5, 2.0, 3.0]
Default Value: 1 - Query query: this object stores the query information for this bond; if it is undefined, then there is no query associated with this bond
Default Value: undefined - String stereo: stereochemical bias of the bond, must be one of the BOND_STEREO constants
Default Value: BOND_STEREO_NONE - Boolean isHover: if true, this represents that this bond is selected, draws brown handles
- Boolean isSelected: if true, this represents that this atom is selected, draws blue handles
- Ring ring: the largest containing SSSR ring
- Point molCenter: metadata set by the containing Molecule, the center of the molecule that contains this bond
- Function contains(Atom a): returns true if this Bond connects to the input atom
returns Boolean
Unit: true/false - Function draw(Context ctx, Styles styles): draws this bond to the canvas that owns the Context using the given Styles
- Function drawDecorations(Context ctx, Styles styles): draws decorations for the SketcherCanvas that owns the Context and has this Bond hovered
- Function drawLewisStyle(Context ctx, Styles styles, Number y1, Number x2, Number x1, Number y2): draws this bond in Lewis Dot style given the input parameters
- Function getCenter(): returns a Point that specifies the center between the two Atoms in the Bond
returns Point
Unit: pixels - Function getLength(): returns the bond length on the XY plane
returns Number
Unit: pixels - Function getLength3D(): returns the 3D bond length
returns Number
Unit: pixels - Function getNeighbor(Atom a): returns the Atom opposite Atom a
returns Atom - Function render(GLContext gl, Styles styles): renders this bond to the 3D scene in the WebGL canvas that owns the GLContext using the given Styles
- Function renderHighlight(GLContext gl, Styles styles): renders the highlight for this bond the given Styles
- Function renderPicker(GLContext gl, Styles styles): this function renders the bond for the picking system
ChemDoodle.structures.Molecule
represents a chemical moleculeconstructor = new Function Molecule()
- Array atoms: constituent atoms
- Array bonds: constituent bonds
- Array rings: constituent rings
- Boolean findRings: will find rings in the check() function; this should be disabled by you, if not necessary, to improve performance
Default Value: true - Function check(Boolean force): sets up the molecule for drawing by checking for lone carbons, rings and z-sorting, as well as setting up the metadata for drawing; since this is a cpu intensive function, the force parameter is for efficiency, so the molecule can be checked often, with a false or no parameter and it will keep track that it needs to be checked, then when an important function (such as a render) needs the check to go through, you pass it a true and the check will be forced if the molecule needs to be checked.
- Function draw(Context ctx, Styles styles): draws this molecule to the canvas that owns the Context using the given Styles
- Function getAngles(Atom a): with a as the origin, returns an Array of all the angles to the immediately connected atoms in this Molecule, in ascending order
returns Array
Unit: radians - Function getAtomGroup(Atom atom): Given an input atom from this molecule, return the group it is enclosed within, either ring block or chain
returns Array
Unit: Atom - Function getAverageBondLength(): calculates the average bond length of the molecule, or returns 0 if there are no bonds, this is a 2D function
returns Number
Unit: pixels - Function getBondGroup(Bond bond): Given an input bond from this molecule, return the group it is enclosed within, either ring block or chain
returns Array
Unit: Bond - Function getBonds(Atom a): returns an Array of Bond objects that contain the input Atom a in the molecule
returns Array
Unit: Bond - Function getBounds(): returns a Bounds object containing the 2D bounds of the graphical molecule
returns Bounds - Function getBounds3D(): returns a Bounds object containing the 3D bounds of the graphical molecule
returns Bounds - Function getCenter(): returns a Point that specifies the center of this Molecule
returns Point
Unit: pixels - Function getCenter3D(): returns an Atom that specifies the center of this Molecule in 3 dimensions
returns Atom
Unit: pixels - Function getCoordinationNumber(Array bs): adds the bond orders from the bs (Array of Bond) parameter together to calculate the coordination number
returns Number
Unit: coordination number - Function getDimension(): returns a Point that specifies the width and height of this Molecule in the XY plane. Among other uses, this method can be used to first find the dimensions of a molecule to set the dimensions of a Canvas to perfectly fit it (make sure to add some aesthetic buffer space).
returns Point
Unit: pixels - Function render(GLContext gl, Styles styles): renders this molecule to the 3D scene in the WebGL canvas that owns the GLContext using the given Styles
- Function renderPickFrame(GLContext gl, Styles styles, Array objects, Boolean includeAtoms, Boolean includeBonds): renders the picking scene to the backbuffer for analysis; objects is an indexed array that stores the object information for the primitive geometries; includeAtoms and includeBonds determine if these objects will be selectable
- Function scaleToAverageBondLength(Number length): scales the molecule so that the average bond length equals the input length, this is a 2D function
- Function setupMetaData(): sets up metadata for the molecule, used internally to determine how graphics are rendered
- Function sortAtomsByZ(): sorts atoms in ascending order by z coordinate
- Function sortBondsByZ(): sorts bonds in ascending order by their z coordinate
ChemDoodle.structures.Spectrum
data structure to hold spectrum informationconstructor = new Function Spectrum()
- Array data: the spectrum plot as an array of Point objects
- Array metadata: this is an Array of String containing the header records from the JCAMP file
- Array dataDisplay: this is an Array of Object. Each object describes an item in the list of data items to be displayed on the top left of the spectrum. Three String parameters may be present: tag, display, value. If tag is present, then the JCAMP metadata will be searched for the corresponding JCAMP tag and placed in the list. If this tag is not found, it is ignored. If display is also provided, then the JCAMP tag name is replaced by the more appropriate title. You can also add custom items by providing the display and value parameters. If the value parameter is defined, then the tag parameter will be ignored if also defined.
- Number minX: the minimum domain value, set up by the setup method to the smallest x value in the data array after the spectrum is read, can also be manually set
- Number maxX: the maximum domain value, set up by the setup method to the largest x value in the data array after the spectrum is read, can also be manually set
- Number integrationSensitivity: this value states that only values greater than this percentage of the highest y-value in the spectrum will be considered in the integration
Default Value: 0.01
Unit: %/100 - String title: the title of the spectrum, most spectrum file formats provide a title, no title is displayed if the value is undefined
Default Value: undefined - String xUnit: the unit of the domain to be displayed under the x-axis, no x-axis title is displayed if the value is undefined
Default Value: undefined - String yUnit: the unit of the domain to be displayed under the y-axis, no y-axis title is displayed if the value is undefined
Default Value: undefined - Boolean continuous: determines how the plot will be drawn, if continuous is true, then the plot is rendered as a path from Point to Point in the data array, if continuous is false, then each data point will be rendered as a vertical line from y = 0
Default Value: true - Object memory: an object storing dimension metadata from the previous render
- Function alertMetadata(): will popup a Javascript alert dialog with the metadata from the JCAMP file
- Function draw(Context ctx, Styles styles, Number width, Number height): draws this spectrum and graph to the canvas that owns the Context using the given Styles, the canvas's width and height are also provided
- Function drawPlot(Context ctx, Styles styles, Number width, Number height, Number offsetTop, Number offsetLeft, Number offsetBottom): draws the spectrum plot to the canvas that owns the Context using the given Styles, the canvas's width and height, and the offsets from the top, bottom, and left are also provided
- Function getClosestPlotInternalCoordinates(Number x): given the input x-coordinate from the canvas space, this function will return a point containing the plot coordinates of the spectrum point that has its x-coordinate closest to the input x coordinate; because the smallest resolution on screens is a pixel, this function will actually find the highest peak within a pixel range of the input x coordinate to return; can only be called after a render when memory is set, this function doesn't make sense without a render first anyway
returns Point
Unit: spectrum units - Function getInternalCoordinates(Number x, Number y): function to obtain the x and y coordinates within the spectrum's plot space given the input x and y coordinates from the canvas space; can only be called after a render when memory is set, this function doesn't make sense without a render first anyway; essentially, this just calls getInverseTransformedX() and getInverseTransformedY()
returns Point
Unit: spectrum units - Function getInverseTransformedX(Number x): function to obtain the x-coordinate within the spectrum's plot space given the input x-coordinate from the canvas space; can only be called after a render when memory is set, this function doesn't make sense without a render first anyway
returns Number
Unit: x axis units - Function getInverseTransformedY(Number y): function to obtain the y-coordinate within the spectrum's plot space given the input y-coordinate from the canvas space; can only be called after a render when memory is set, this function doesn't make sense without a render first anyway
returns Number
Unit: y axis units - Function getTransformedX(Number x, Styles styles, Number width, Number offsetLeft): used internally to obtain the x-coordinate within the canvas space given the input x-coordinate from the spectrum's plot space
returns Number
Unit: pixels - Function getTransformedY(Number x, Styles styles, Number height, Number offsetBottom, Number offsetTop): used internally to obtain the y-coordinate within the canvas space given the input y-coordinate from the spectrum's plot space
returns Number
Unit: pixels - Function setup(): analyzes the data array for the default domain and scales the range between 0 and 1, called by the interpreters that read spectra files
- Function translate(Number dif, Number width): given the signed translation amount in pixels in the canvas's domain space (in any order), will translate that domain by appropriately setting the minX and maxX parameters given the canvas width
- Function zoom(Number pixel1, Number pixel2, Number width, Boolean scaleY): given the input pixel1 and pixel2 values in the canvas's domain space (in any order), will focus in on that domain by appropriately setting the minX and maxX parameters given the canvas width; optionally, if the scaleY parameter is true, this function will return a Number that should be the new scale for the Styles.scale value to see the full peak; this function returns nothing if scaleY is false
returns Number newScale
ChemDoodle.structures.Reaction
represents a chemical reactionconstructor = new Function Reaction()
- Function resolve(Line arrow, Array molecules): given a reaction arrow and an array of molecules, this function will separate the molecules into reactants and products. An object is returned with two subarrays named "reactants" and "products"
returns Object
ChemDoodle.structures.Queue
a queue data structureconstructor = new Function Queue()
- Function dequeue(): returns and removes the element at the beginning of the queue
returns Object - Function enqueue(Object o): adds an element to the end of the queue
returns Object - Function getOldestElement(): returns, but does not remove, the element at the beginning of the queue
returns Object - Function getSize(): returns the size of the queue
returns Number - Function isEmpty(): returns true if there are no elements in the queue
returns Boolean
ChemDoodle.structures.d2
this package hosts all data structures that represent 2D objects that are rendered in 2D canvases.ChemDoodle.structures.d2._Shape
the parent data structure for all 2D shapes, it should not be instantiated.- Function drawAnchor(Context ctx, Styles styles, Point p, Boolean hovered): draws this shape's anchor to the SketcherCanvas that owns the Context using the given Styles and mouse position
- Function drawDecorations(Context ctx, Styles styles): draws this shape's decorations to the SketcherCanvas that owns the Context using the given Styles
- Function getBounds(): returns a Bounds object containing the 2D bounds of the shape
returns Bounds
ChemDoodle.structures.d2.Line
represents a 2D line, arrows can be attachedconstructor = new Function Line(Point p1, Point p2)
- static String ARROW_SYNTHETIC: specifies a synthetic arrow
- static String ARROW_RETROSYNTHETIC: specifies a retrosynthetic arrow
- static String ARROW_RESONANCE: specifies a resonance arrow
- static String ARROW_EQUILIBRIUM: specifies a equilibrium arrow
- String arrowType: the arrow type the line is to be rendered as; if undefined, the line is rendered as a plain line
Default Value: undefined - String topText: the text to be rendered above the arrow (conditions, etc.); if undefined, no text is rendered above the arrow
Default Value: undefined - String bottomText: the text to be rendered below the arrow; if undefined, no text is rendered below the arrow
Default Value: undefined - Array reactants: this array contains one representative atom from each molecule assigned as a reactant to this line shape, typically when representing a reaction as an arrow
Default Value: [] - Array products: this array contains one representative atom from each molecule assigned as a product to this line shape, typically when representing a reaction as an arrow
Default Value: [] - Point p1: the set of coordinates that represent the start of the line
- Point p2: the set of coordinates that represent the end of the line
- Function draw(Context ctx, Styles styles): draws this line to the canvas that owns the Context using the given Styles
- Function getPoints(): returns an Array of Point objects that contains p1 and p2
returns Array
Unit: Point - Function isOver(Point p, Number barrier): returns true if the input point is above the shape
returns Boolean
ChemDoodle.structures.d2.Pusher
represents electron movement, draws a bezier curve between the chemical objects involved with the transferconstructor = new Function Pusher(Object o1, Object o2, Integer numElectron)
- Integer numElectron: the number of electrons being pushed; if the number is -1, this is a bond forming pusher
Default Value: 1
Unit: 1, 2 or -1 - Object o1: the chemical object (atom or bond) that the electron(s) are coming from
- Object o2: the chemical object (atom or bond) that the electron(s) are moving to
- Function draw(Context ctx, Styles styles): draws this pusher to the canvas that owns the Context using the given Styles
- Function drawDecorations(Context ctx, Styles styles): draws this pusher's decorations in the sketcher if it is hovered
- Function getPoints(): returns an empty Array
returns Array
Unit: Point - Function isOver(Point p, Number barrier): returns true if the input point is above the shape
returns Boolean
ChemDoodle.structures.d2.AtomMapping
this shape stores an atom mapping pair, usually used for advanced reaction searchesconstructor = new Function AtomMapping(Atom o1, Atom o2)
- String label: the label that is displayed for this atom mapping pair, this value is automatically set by the SketcherCanvas class before repaint
Default Value: 0
Unit: typically a positive integer as a String - Boolean error: if true, this atom mapping will be rendered in the Styles.colorError color
Default Value: false
Unit: true/false - Atom o1: the first atom of the mapping
- Atom o2: the second atom of the mapping
- Function draw(Context ctx, Styles styles): draws this atom mapping to the canvas that owns the Context using the given Styles
- Function getPoints(): returns an array with the points corresponding to the locations that the atom mappings are rendered at
returns Array
Unit: Point - Function isOver(Point p, Number barrier): returns true if the input point is above the shape
returns Boolean
ChemDoodle.structures.d2.Bracket
represents a 2D bracket with a charge, multiplicity, repeat or mixconstructor = new Function Bracket(Point p1, Point p2)
- Number charge: an Integer describing the charge amount associated with this bracket; this number is rendered at the top-right of the bracket
Default Value: 0 - Number mult: an Integer describing the multiple associated with this bracket, useful for reaction schemes; this number is rendered at the left center of the bracket
Default Value: 0 - Number repeat: an Integer describing the repeat count associated with this bracket, useful for polymers; this number is rendered at the bottom-right of the bracket
Default Value: 0 - Point p1: the set of coordinates that represent the start of the bracket
- Point p2: the set of coordinates that represent the end of the bracket (opposite corner from the start)
- Function draw(Context ctx, Styles styles): draws this bracket to the canvas that owns the Context using the given Styles
- Function getPoints(): returns an Array of Point objects that contains p1 and p2
returns Array
Unit: Point - Function isOver(Point p, Number barrier): returns true if the input point is above the shape
returns Boolean
ChemDoodle.structures.d2.RepeatUnit
represents a repeat group with a repeat rangeconstructor = new Function RepeatUnit(Point b1, Point b2)
- Boolean flip: Repeat units in rings (where each of the end bonds is a member of one and only one ring each and they are both members of the same ring) can contain one of two subsets of atoms. This is controlled by the “flip” parameter of the RepeatUnit. By default, the contents of the repeat unit will contain the first atom of the first bond (b1.a1). If flipped, the contents of the repeat unit will contain the second atom of the first bond (b1.a2).
Default Value: false - Number n1: an Integer describing the first magnitude of the repeat range
Default Value: 1 - Number n2: an Integer describing the second magnitude of the repeat range
Default Value: 4 - Array contents: an array of Atoms collecting all of the atoms covered by this repeat unit; this must be set accordingly by the RepeatUnit.setContents() function, which may be overridden
- Array ps: an array of Point containing the four corner points of the bracket ends; is only set after it is first drawn
- Bond b1: the bond that specifies the start position of the repeating group
- Bond b2: the bond that specifies the end position of the repeating group
- Function draw(Context ctx, Styles styles): draws this repeat unit to the canvas that owns the Context using the given Styles
- Function drawDecorations(Context ctx, Styles styles): draws this repeat unit's decorations in the sketcher if it is hovered
- Function getPoints(): returns an Array of Point objects corresponding to the four corners of the drawn bracket ends
returns Array
Unit: Point - Function isOver(Point p, Number barrier): returns false
returns Boolean - Function setContents(SketcherCanvas sketcher): called before drawing if necessary; this function resolves the contents of the repeat units and sets it to the contents variable of the instance
ChemDoodle.structures.d2.VAP
represents a variable attachment point with a subtituent and attachments; the x and y constructor parameters are used for the location of the asteriskconstructor = new Function VAP(Number x, Number y)
- Atom asterisk: the location of the asterisk that represents this variable attachment point
- Atom substituent: the substituent attached to this variable attachment point
- Number bondType: the bond type of the substituent bond from the variable attachment point to the substituent; same bond types as used for the Bond class
Default Value: 1 - Array attachments: an array of Atoms collecting all of the atoms this variable attachment point is connected to, excluding the substituent
Default Value: [] - Function draw(Context ctx, Styles styles): draws this variable attachment point to the canvas that owns the Context using the given Styles
- Function drawDecorations(Context ctx, Styles styles): draws this variable attachment point's decorations in the sketcher if it is hovered
- Function getPoints(): returns an Array of Point objects containing one point of the asterisk location
returns Array
Unit: Point - Function isOver(Point p, Number barrier): returns false
returns Boolean
ChemDoodle.structures.d3
this package hosts all data structures that represent 3D objects that are rendered in 3D canvases.ChemDoodle.structures.d3._Mesh
parent class for all 3D shapes, it should not be instantiated.- Array positionData: an array of floating point values that describe the position of verticies in a mesh.
- Array normalData: an array of floating point values that describe the surface normals
- Array indexData: an array of integer values that indexes the triplets contained within the positionData and normalData arrays
- Function bindBuffers(GLContext gl): binds the vertex buffers to the given WebGL context; calls setupBuffers if buffers have not been already set up.
- Function generateBuffers(GLContext gl, Array normalData, Array indexData): given a WebGL context and vertex buffer data, returns an array containing the position, normal, and index buffers.
- Function setupBuffers(GLContext gl): sets up vertex buffers for a given WebGL context prior to rendering.
- Function storeData(Array positionData, Array normalData, Array indexData): stores position, normal, and index vertex buffer data for later use by other methods.
ChemDoodle.structures.d3._Measurement
parent class for all 3D measurements, it should not be instantiated.prototype = _Mesh
- Function render(GLContext gl, Styles styles): renders the measurement to the given WebGL context according to the provided visual specifications
- Function renderText(GLContext gl, Styles styles): renders the text associated with the measurement to the given WebGL context according to the provided visual specifications
- abstract Function calculateData(Styles styles): abstract method for measuring the desired quantity and generating rendering data for use in a 3D canvas.
- abstract Function getText(Styles styles): abstract method for returning an object with the position and value the measurementfor rendering as text in a 3D canvas
returns Object
ChemDoodle.structures.d3._Surface
parent class for all 3D surfaces, it should not be instantiated.prototype = _Mesh
- Function build(Array atoms, Number probeRadius, Number resolution): generate and build the 3D surface, using marching cubes, including simplifying the mesh, smoothing and normal generation; this function is dependent on the input atoms, probeRadius and resolution
- Function generate(Number xdif, Number ydif, Number zdif, Number step, Number range, Number xsteps, Number ysteps, Number zsteps): this is the algorithm that generates the isosurface so that the surface can be built
- Function render(GLContext gl, Styles styles): renders the surface to the given WebGL context according to the provided visual specifications
- abstract Function calculate(Number x, Number y, Number z): calculate the isosurface value for the surface given the x, y and z coordinates; this is an abstract function to be implemented by child Surfaces.
ChemDoodle.structures.d3.Angle
a child of the _Measurement class, represents the angle between three atomsconstructor = new Function Angle(Atom a1, Atom a2, Atom a3)
prototype = _Measurement
- Atom a1: first of three atoms that form the angle.
- Atom a2: second of three atoms that form the angle.
- Atom a3: third of three atoms that form the angle.
- vec3 vec1: vector from a1 to a2, computed by calculateData
- vec3 vec2: vector from a2 to a3, computed by calculateData
- Number angle: angle formed by vec1 and vec2, computed by calculateData
- override Function calculateData(Styles styles): calculates the angle between the three atoms and creates the required data to render the angle in a 3D canvas.
- override Function getText(Styles styles): returns an object with the position and value of the angle for rendering as text in a 3D canvas
returns Object
ChemDoodle.structures.d3.Arrow
a child of the _Mesh class, represents a cylindrical arrow with headconstructor = new Function Arrow(Number radius, Number bands)
prototype = _Mesh
ChemDoodle.structures.d3.Box
a child of the _Mesh class, represents a 3D rectangular prism, or boxconstructor = new Function Box(Number width, Number height, Number depth)
prototype = _Mesh
ChemDoodle.structures.d3.Camera
helper object keep track of the projection and view matrixes from the camera into the sceneconstructor = new Function Camera()
- Number fieldOfView: field of view angle for the perspective projection
Default Value: 45 - Number aspect: aspect ration for the projection
Default Value: 1 - Number near: near clip value for the projection
Default Value: 0.1 - Number far: far clip value for the projection
Default Value: 10000 - Number zoom: the zoom value into the scene for the projection
Default Value: 1 - mat4 viewMatrix: the matrix for the model view
Default Value: m4.identity([]) - mat4 projectionMatrix: the matrix for the projection
Default Value: m4.identity([]) - Function focalLength(): returns the calculated focal length
returns Number - Function orthogonalProjectionMatrix(): returns the orthogonal projection matrix given the camera's values, updating the internal matrix
returns mat4 - Function perspectiveProjectionMatrix(): returns the perspective projection matrix given the camera's values, updating the internal matrix
returns mat4 - Function updateProjectionMatrix(Boolean isProjection): returns and recalculates the internal projection matrix, either perspective or orthogonal, given the parameter
returns mat4 - Function zoomIn(): zooms in the camera view
- Function zoomOut(): zooms out the camera view
ChemDoodle.structures.d3.Compass
helper object to render the compassconstructor = new Function Compass(GLContext gl, Styles styles)
- Function render(GLContext gl, Styles styles): renders the compass to the given WebGL context according to the provided visual specifications
- Function renderArrow(GLContext gl, String color, Array mvMatrix): renders an individual arrow
ChemDoodle.structures.d3.Cylinder
a child of the _Mesh class, represents a 3D cylinderconstructor = new Function Cylinder(Number radius, Number height, Number bands, Boolean closed)
prototype = _Mesh
ChemDoodle.structures.d3.FrameBuffer
a class for supporting a frame buffer object (FBO), with knowledge of depth buffer capabilities of the given WebGL contextconstructor = new Function FrameBuffer()
- Function bind(GLContext gl, Integer width, Integer height): sets the size of the FBO buffer with both width and height being set to the input parameter and then binds it to the context
- Function init(GLContext gl): initializes the FBO
- Function setColorRenderBuffer(GLContext gl, Number renderbuffer, Number attachment): set color texture
- Function setColorTexture(GLContext gl, Number texture, Number attachment): set color texture
- Function setDepthRenderBuffer(GLContext gl, Number renderbuffer): set color texture
- Function setDepthTexture(GLContext gl, Number texture): set color texture
ChemDoodle.structures.d3.Texture
a class for defining texturesconstructor = new Function Texture()
- Function init(GLContext gl, Number type, Number internalFormat, Number format): initializes the texture
- Function setParameter(GLContext gl, Integer width, Integer height): sets the size of the texture with both width and height being set to the input parameter and then binds it to the context
ChemDoodle.structures.d3.Renderbuffer
a class representing the render bufferconstructor = new Function Renderbuffer()
- Function init(GLContext gl, Number type, Number internalFormat, Number format): initializes the render buffer
- Function setParameter(GLContext gl, Integer width, Integer height): sets the size of the render buffer with both width and height being set to the input parameter and then binds it to the context
ChemDoodle.structures.d3.SSAO
a class controlling Screen Space Ambient Occlusion (SSAO) featuresconstructor = new Function SSAO()
- Function initNoiseTexture(GLContext gl): binds the SSAO noise texture to the context
- Function initSampleKernel(Number kernelSize): initializes the sample kernel
ChemDoodle.structures.d3.Distance
a child of the _Measurement class, represents the distance between two atomsconstructor = new Function Distance(Atom a1, Atom a2, vec3 node, Number offset)
prototype = _Measurement
- Atom a1: first of the two atoms whose distance is being measured.
- Atom a2: second of the two atoms whose distance is being measured.
- vec3 node: an optional vector that displaces the measured vector from the midpoint of the two atoms
- Number offset: an optional distance to offset the measurement text
- override Function calculateData(Styles styles): calculates the distance between the two atoms and creates the required data to render the distance in a 3D canvas.
- override Function getText(Styles styles): returns an object with the position and value of the distance for rendering as text in a 3D canvas
returns Object
ChemDoodle.structures.d3.Fog
handles fogging for WebGL canvases.constructor = new Function Fog(String fog, Number fogStart, Number fogEnd, Number density)
- Array colorRGB: the color of the fog, stored as an array of representing the RGB values.
- Number fogStart: number value that the fog starts from. Choose a value between 0 and 1, and this value should be less than fogEnd.
- Number fogEnd: number value that the fog ends at. Choose a value between 0 and 1, and this value should be greater than fogStart.
- Number density: the density of the fog for exp1 and exp2 algorithms.
- Function fogScene(String color, Number fogStart, Number fogEnd, Number density): sets up the values for the fogging algorithm.
ChemDoodle.structures.d3.Line
a child of the _Mesh class, represents a lineconstructor = new Function Line()
prototype = _Mesh
ChemDoodle.structures.d3.Quad
a child of the _Mesh class, represents a quadconstructor = new Function Quad()
prototype = _Mesh
ChemDoodle.structures.d3.Pill
a child of the _Mesh class, represents a 3D pill geometryconstructor = new Function Pill(Number radius, Number height, Number latitudeBands, Number longitudeBands)
prototype = _Mesh
ChemDoodle.structures.d3.Ribbon
a child of the _Mesh class, represents a ribbon typically used in protein renderingsconstructor = new Function Ribbon(Array chain, Number offset, Boolean cartoon)
prototype = _Mesh
- Array paritions: an array of sub-meshes that make up the ribbon
- Array segments: an array of sub-meshes that make up residues in the ribbon.
- Array cartoonSegments: an array of sub-meshes that make up cartoonized residues in the ribbon.
- Integer partitions.lastRender: keeps track of last partition rendered
- Boolean front: indicates whether the front or the back of the ribbon is visible.
- Function render(GLContext gl, Styles styles): renders the ribbon to the given WebGL context according to the provided visual specifications
- override Function storeData(Array positionData, Array normalData, Array indexData): overrides the storeData function of the Mesh class to pull vertex data from the first member of the partition array; clears the partition array to save memory if there is only one partition.
ChemDoodle.structures.d3.Shape
a child of the _Mesh class, represents a shape described by a set of points in the xy plane and a thickness in the z plane.constructor = new Function Shape(Array points, Number thickness)
prototype = _Mesh
ChemDoodle.structures.d3.SASSurface
a child of the _Surface class, this surface defines a solvent accessible surface.constructor = new Function SASSurface(Array atoms, Number probeRadius, Number resolution)
prototype = _Surface
- Array atoms: the array of Atom objects this surface is based on
- Number resolution: this is the number of divisions the smallest side of the rectangular prism that encompases the isosurface is divided into, a value of 30 is typically acceptable
- Number probeRadius: the radius of the probe used to define the surface
- override Function calculate(Number x, Number y, Number z): calculate the isosurface value for the surface given the x, y and z coordinates; this is an abstract function to be implemented by child Surfaces.
ChemDoodle.structures.d3.SESSurface
a child of the _Surface class, this surface defines a solvent excluded (also known as Connolly) surface. (Proprietary Only)constructor = new Function SESSurface(Array atoms, Number probeRadius, Number resolution)
prototype = _Surface
- Array atoms: the array of Atom objects this surface is based on
- Number resolution: this is the number of divisions the smallest side of the rectangular prism that encompases the isosurface is divided into, a value of 30 is typically acceptable
- Number probeRadius: the radius of the probe used to define the surface
- override Function calculate(Number x, Number y, Number z): calculate the isosurface value for the surface given the x, y and z coordinates; this is an abstract function to be implemented by child Surfaces.
ChemDoodle.structures.d3.Sphere
a child of the _Mesh class, respresents a sphere with a given radius and number of latitude and longitude bands.constructor = new Function Sphere(Number radius, Number latitudeBands, Number latitudeBands)
prototype = _Mesh
ChemDoodle.structures.d3.Star
a child of the _Mesh class, represents a small star (mainly used to depict solvent in macromolecule renderings).constructor = new Function Star()
prototype = _Mesh
ChemDoodle.structures.d3.Tube
a child of the _Mesh class, represents a tube of the sort typically used in macromolecular backbone renderings.constructor = new Function Tube(Array chain, Number thickness, Number cylinderResolution)
prototype = _Mesh
- Array paritions: cylindrical meshes that make
- Array ends: sphere meshes at the end of the each tube.
- Function render(GLContext gl, Styles styles): renders the tube to the given WebGL context according to the provided visual specifications
ChemDoodle.structures.d3.UnitCell
a child of the _Mesh class, represents a crystallographic unit cell rendered from a set of vectors.constructor = new Function UnitCell(Array lengths: this is an array of length 3, with the length values of the unit cell for a, b, and c in that order
Unit: Angstroms, Array angles: this is an array of length 3, with the angle values of the unit cell for alpha, beta, and gamma in that order
Unit: radians, Array offset: this is an array of length 3, with the ABC offset values of the unit cell for A, B and C in that order; these offset values are in internal coordinate space; if not provided, the default offset will be [0, 0, 0] to start the unit cell at the origin
Default Value: [0, 0, 0]
Unit: ABC Internal Coordinates)
prototype = _Mesh
- Function render(GLContext gl, Styles styles): renders the unit cell to the given WebGL context according to the provided visual specifications
ChemDoodle.structures.d3.VDWSurface
a child of the _Surface class, this surface defines a van der Waals surface.constructor = new Function VDWSurface(Array atoms, Number resolution)
prototype = _Surface
- Array atoms: the array of Atom objects this surface is based on
- Number resolution: this is the number of divisions the smallest side of the rectangular prism that encompases the isosurface is divided into, a value of 30 is typically acceptable
- Number probeRadius: the radius of the probe used to define the surface, vdW surfaces are not dependent on a probe, and this value has no effect on the VDWSurface class
- override Function calculate(Number x, Number y, Number z): calculate the isosurface value for the surface given the x, y and z coordinates; this is an abstract function to be implemented by child Surfaces.
ChemDoodle.structures.d3.Light
represents a light source with given RGB specular and diffuse colors, as well as a vector describing the direction it is shining in.constructor = new Function Light(String specularColor, String diffuseColor, vec3 direction)
- Array diffuseColor: an array of RGB values describing the diffuse color of the light.
- Array specularColor: an array of RGB values describing the specular color of the light.
- vec3 direction: a vector pointing in the direction that the light is shining.
- Camera camera: a pointer to the associated camera view for the Canvas3D.
- Function lightScene(String specularColor, String diffuseColor, vec3 direction): sets up the values for the light
- Function updateView(): sets up the projection and perspective matrixes from the light's perspective, mainly for shadow maps
ChemDoodle.structures.d3.Material
contains material properties for a given 3D contextconstructor = new Function Material(GLContext gl)
- Array aCache: array storing the ambient color.
- Array dCache: array storing the diffuse color.
- Array sCache: array storing the specular color.
- Number snCache: current shininess value.
- Number alCache: current alpha value.
- Function setDiffuseColor(Array diffuseColor): sets the diffuse color to the values contained in the provided array.
- Function setDiffuseColor(Number alpha): sets the alpha transparency value.
- Function setTempColors(Array ambientColor, Array diffuseColor, Array specularColor, Number shininess): sets temporary values for all colors and shininess.
ChemDoodle.structures.d3.TextImage
this class manages an invisible 2D <canvas> for rendering character data to be used in WebGL components.constructor = new Function TextImage()
ChemDoodle.structures.d3.TextMesh
this class creates the WebGL text objects that are rendered to WebGL components.constructor = new Function TextMesh()
ChemDoodle.structures.d3.Label
this class defines the default text rendering of the scene.constructor = new Function Label()
ChemDoodle.structures.d3._Shader
the parent class for the various vertex and fragment shader pairs for WebGL canvases.- Function diableAttribsArray(GLContext gl): disables the vertex attributes array.
- Function enableAttribsArray(GLContext gl): enables the vertex attributes array.
- Function getShader(GLContext gl, Integer id): returns a pointer to the requested shader.
returns WebGLShader - Function getShaderFromStr(GLContext gl, Integer shaderType, String strSrc): initializes a shader given the id and source of the shader.
returns WebGLShader - Function init(GLContext gl): initializes the vertex and fragment shaders for a given WebGL canvas.
- Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- Function onShaderAttached(GLContext gl): called when the shader is attached to initialize locations for attribute variables.
- Function setMatrixUniforms(GLContext gl, mat4 modelMatrix): set the model view matrix to the shader (with pre-processing).
- Function setModelViewMatrix(GLContext gl, mat4 mvMatrix): set the model view matrix to the shader.
- Function setProjectionMatrix(GLContext gl, mat4 matrix): set the projection matrix to the shader.
- Function useShaderProgram(GLContext gl): enables this shader for the GL context.
- abstract Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- abstract Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.DepthShader
this class handles the rendering to depth map FBOs, mainly for shadows. (Proprietary Only)constructor = new Function DepthShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.FXAAShader
this class handles the deferred shading anti-aliasing pass, based on the FXAA algorithm.constructor = new Function FXAAShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.LabelShader
this class handles the rendering of text textures that are rendered to WebGL components.constructor = new Function LabelShader()
prototype = _Shader
- Function setDimension(GLContext gl, Integer width, Integer height): set the texture dimensions to the shader program.
- override Function diableAttribsArray(GLContext gl): disables the vertex attributes array.
- override Function enableAttribsArray(GLContext gl): enables the vertex attributes array.
- override Function init(GLContext gl): initializes the vertex and fragment shaders for a given WebGL canvas.
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
- override Function onShaderAttached(GLContext gl): called when the shader is attached to initialize locations for attribute variables.
ChemDoodle.structures.d3.LightingShader
this class handles the deferred shading lighting pass.constructor = new Function LightingShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.NormalShader
this class handles the deferred shading normals pass.constructor = new Function NormalShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.OutlineShader
this class handles the deferred shading outlining pass.constructor = new Function OutlineShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.PhongShader
this is the default rendering shader for the ChemDoodle Web Components, using a Blinn-Phong model.constructor = new Function PhongShader()
prototype = _Shader
- override Function diableAttribsArray(GLContext gl): disables the vertex attributes array.
- override Function enableAttribsArray(GLContext gl): enables the vertex attributes array.
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.PickShader
this class handles the rendering of pickable objects, allowing the Picker to work.constructor = new Function PickShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.PositionShader
this class handles the deferred shading position attribute pass.constructor = new Function PositionShader()
prototype = _Shader
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.QuadShader
this class handles the rendering of quads to the canvas.constructor = new Function QuadShader()
prototype = _Shader
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.SSAOBlurShader
this class handles the deferred shading SSAO blur pass. (Proprietary Only)constructor = new Function SSAOBlurShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.SSAOShader
this class handles the deferred shading SSAO pass. (Proprietary Only)constructor = new Function SSAOShader()
prototype = _Shader
- override Function initUniformLocations(GLContext gl): initializes the main uniform variables for the shaders.
- override Function loadDefaultFragmentShader(GLContext gl): load the default fragment shader.
- override Function loadDefaultVertexShader(GLContext gl): load the default vertex shader.
ChemDoodle.structures.d3.Picker
this class manages the FBO and picking system for WebGL components.constructor = new Function Picker()
- Function init(GLContext gl): initializes the picking system for a given WebGL canvas.
- Function setDimension(GLContext gl, Number width, Number height): sets the width and height information
ChemDoodle.uis
this package contains all of the classes and source to implement the advanced user interfaces which currently includes the ChemDoodle Web Sketcher the ChemDoodle Web 3D Editor. This package is not avaialble in the ChemDoodle Web Components core. It is added by including the ChemDoodle Web Components uis extensions.ChemDoodle.uis.CopyPasteManager
this class manages the copy and paste clipboard actions for a sketcher.constructor = new Function CopyPasteManager(SketcherCanvas sketcher)
- SketcherCanvas sketcher: the associated sketcher
- Object data: the JSON object of the data on the clipboard
- Function copy(Boolean remove): perform the copy action on a selection if present; the boolean parameter defines whether the copied content is also remove, so sending true executes a cut action
- Function paste(): perform a paste action for the sketcher
ChemDoodle.uis.actions
this package contains all Action classes. Actions define changes to content in the sketcher that can be undone and redone.ChemDoodle.uis.actions._Action
is the parent class for actions associated with the sketcher. Its basic functionality allows for content to be changed and the ability to reverse those changes.constructor = new Function _Action()
- Function checks(SketcherCanvas sketcher): checks the content of the given sketcher, reassessing any metadata after the change, finishing by repainting the sketcher
- Function forward(SketcherCanvas sketcher): performs the action for the given sketcher instance
- Function reverse(SketcherCanvas sketcher): reverses the action for the given sketcher instance
- abstract Function innerforward(): must be defined by child Actions to execute the forward changes, is called by forward()
- abstract Function innerreverse(): must be defined by child Actions to execute the reverse changes, is called by reverse()
ChemDoodle.uis.actions.AddAction
is a child of the Action class and handles adding bonds and atoms to a single molecule.constructor = new Function AddAction(SketcherCanvas sketcher, Atom a, Array as, Array bs)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Atom a: the Atom that identifies the molecule that atoms and bonds are added to
- Array as: the atoms to be added
- Array bs: the bonds to be added
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.AddContentAction
is a child of the Action class and handles adding content with new Molecules and Shapes to the sketcher.constructor = new Function AddContentAction(SketcherCanvas sketcher)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Array mols: the molecules being added
- Array shapes: the shapes being added
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.AddShapeAction
is a child of the Action class and handles adding a single shape to the sketcher.constructor = new Function AddShapeAction(SketcherCanvas sketcher, _Shape s)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- _Shape s: the shape that is added to the sketcher
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.AddVAPAttachmentAction
is a child of the Action class and handles adding a connection to a variable attachment point, whether attachment or substituent.constructor = new Function AddVAPAttachmentAction(VAP vap, Atom a, Boolean substituent)
prototype = _Action
- VAP vap: the variable attachment point that this action is associated with
- Atom a: the atom being added as a connection
- Boolean substituent: true if this connection is the substituent connection
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeBondAction
is a child of the Action class and handles changing the bond type of a Bond.constructor = new Function ChangeBondAction(Bond b, Integer orderAfter, String stereoAfter)
prototype = _Action
- Bond b: the manipulated bond
- Integer orderBefore: the bond order before the change
- Integer orderAfter: the bond order after; if not provided, this value will be the incrementation of orderBefore, or 1 if orderBefore is 3
- String stereoBefore: the bond stereochemistry setting before the change; this should be one of the Bond stereochemistry values
- String stereoAfter: the bond stereochemistry setting before the change; this should be one of the Bond stereochemistry values; if not provided, this value will be STEREO_NONE
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeBracketAttributeAction
is a child of the Action class and handles changing attributes (charge/mult/repeat) for the Charge Bracket shape.constructor = new Function ChangeBracketAttributeAction(Bracket s, Number delta)
prototype = _Action
- Bracket s: the manipulated bracket
- Number delta: the change in amount and type
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeChargeAction
is a child of the Action class and handles changing charges for an Atom.constructor = new Function ChangeChargeAction(Atom a, Number delta)
prototype = _Action
- Atom a: the manipulated atom
- Number delta: the change in charge amount
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeCoordinatesAction
is a child of the Action class and handles changing coordinates for a set of Atoms.constructor = new Function ChangeCoordinatesAction(Array as, Array newCoords)
prototype = _Action
- Array as: the manipulated atoms
- Array recs: an array of objects storing the before and after coordinates for the given atoms based on their current coordinates and the newCoords parameter
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeRepeatUnitAttributeAction
is a child of the Action class and handles changing attributes (charge/mult/repeat) for the Charge Bracket shape.constructor = new Function ChangeRepeatUnitAttributeAction(RepeatUnit s, Number delta)
prototype = _Action
- RepeatUnit s: the manipulated bracket
- Number delta: the change in amount and type
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeLabelAction
is a child of the Action class and handles changing labels for an Atom.constructor = new Function ChangeLabelAction(Atom a, String after)
prototype = _Action
- Atom a: the manipulated atom
- String before: the label before the change
- String after: the label after the change
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeLonePairAction
is a child of the Action class and handles changing the number of lone pairs for an Atom.constructor = new Function ChangeLonePairAction(Atom a, Number delta)
prototype = _Action
- Atom a: the manipulated atom
- Number delta: the change in lone pair count
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeQueryAction
is a child of the Action class and handles changing queries for an Atom.constructor = new Function ChangeQueryAction(Object o, String after)
prototype = _Action
- Object o: the manipulated object, an atom or bond
- Query before: the query before the change
- Query after: the query after the change
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeRadicalAction
is a child of the Action class and handles changing the number of radical electrons for an Atom.constructor = new Function ChangeRadicalAction(Atom a, Number delta)
prototype = _Action
- Atom a: the manipulated atom
- Number delta: the change in radical count
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeEnhancedStereoAction
is a child of the Action class and handles changing the enhanced stereochemistry definition for an Atom.constructor = new Function ChangeEnhancedStereoAction(Atom a, String type, Number group)
prototype = _Action
- Atom a: the manipulated atom
- Number type: the new enhanced stereochemistry type (abs/or/&)
- Number group: the new enhanced stereochemistry group number (should be a positive integer)
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeImplicitHydrogenAction
is a child of the Action class and handles changing the implicit hydrogen count for an Atom.constructor = new Function ChangeImplicitHydrogenAction(Atom a, Number val)
prototype = _Action
- Atom a: the manipulated atom
- Number val: the new implicit hydrogen count (should be a positive integer or 0)
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeIsotopeAction
is a child of the Action class and handles changing the isotope value for an Atom.constructor = new Function ChangeIsotopeAction(Atom a, Number val)
prototype = _Action
- Atom a: the manipulated atom
- Number val: the new isotope value (should be a positive integer)
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeVAPOrderAction
is a child of the Action class and handles changing the bond type for a variable attachment point substituent.constructor = new Function ChangeVAPOrderAction(VAP vap, Number orderAfter)
prototype = _Action
- VAP vap: the variable attachment point that this action is associated with
- Number orderBefore: the original bond type of the substituent bond
- Number orderAfter: the bond type to change the substituent bond to
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ChangeVAPSubstituentAction
is a child of the Action class and handles changing the substituent atom for a veriable attachment point; the bond type of the variable attachment point is reverted to single.constructor = new Function ChangeVAPSubstituentAction(VAP vap, Atom nsub)
prototype = _Action
- VAP vap: the variable attachment point that this action is associated with
- Number orderBefore: the original bond type of the substituent bond
- Atom osub: the original substituent atom
- Atom nsub: the new substituent atom
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.ClearAction
is a child of the Action class and handles clearing the sketcher.constructor = new Function ClearAction(SketcherCanvas sketcher)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Array beforeMols: the molecules present before the clear
- Array beforeShapes: the shapes present before the clear
- Molecule molAfter: the molecule added after the clear in the case of the single molecule sketcher
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.DeleteAction
is a child of the Action class and handles deleting bonds and atoms to a single molecule. This is a reversal of the AddAction class.constructor = new Function DeleteAction(SketcherCanvas sketcher, Atom a, Array as, Array bs)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Atom a: the Atom that identifies the molecule that atoms and bonds are removed from
- Array as: the atoms to be deleted
- Array bs: the bonds to be deleted
- Array ss: the shapes to be deleted, this array is used if deleting the atoms and bonds also deletes some linked shapes
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.DeleteContentAction
is a child of the Action class and handles deleting any arbitrary amount of atoms, bonds and shapes from the sketcher.constructor = new Function DeleteContentAction(SketcherCanvas sketcher, Array as, Array ss)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Array as: the atoms to be deleted
- Array bs: the bonds to be deleted, based on the as Array
- Array ss: the shapes to be deleted
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.DeleteShapeAction
is a child of the Action class and handles removing a single shape from the sketcher.constructor = new Function DeleteShapeAction(SketcherCanvas sketcher, _Shape s)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- _Shape s: the shape that is deleted from the sketcher
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.DeleteVAPConnectionAction
is a child of the Action class and handles removing a connection to a variable attachment point, whether attachment or substituent.constructor = new Function DeleteVAPConnectionAction(VAP vap, Atom connection)
prototype = _Action
- VAP vap: the variable attachment point that this action is associated with
- Atom a: the atom being removed as a connection
- Boolean substituent: true if this connection is the substituent connection
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.FlipAction
is a child of the Action class and handles flipping atoms and shapes. Any stereo bonds passed in through the bs parameter will be converted to their counterpart.constructor = new Function FlipAction(Array ps, Boolean vertical)
prototype = _Action
- Array ps: the points to be edited, including atoms and shape points
- Array bs: the bonds to be flipped, from recessed to protruding or reverse
- Boolean vertical: if true, the flip is vertical, otherwise it is horizontal
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.FlipBondAction
is a child of the Action class and handles flipping the orientation of a Bond.constructor = new Function FlipBondAction(Bond b)
prototype = _Action
- Bond b: the manipulated bond
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.FlipRepeatUnitAction
is a child of the Action class and handles flipping the orientation of a repeat unit in a single unfused ring.constructor = new Function FlipRepeatUnitAction(Bond b)
prototype = _Action
- Bond b: the manipulated repeat unit
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.MoveAction
is a child of the Action class and handles moving atoms and shapes.constructor = new Function MoveAction(Array ps, Point dif)
prototype = _Action
- Array ps: the points to be edited, including atoms and shape points
- Point dif: the change in X and Y coordinates in a Point data structure
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.NewMoleculeAction
is a child of the Action class and handles adding a new discrete Molecule to the sketcher.constructor = new Function NewMoleculeAction(SketcherCanvas sketcher, Array as, Array bs)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Array as: the atoms of the new Molecule
- Array bs: the bonds of the new Molecule
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.RotateAction
is a child of the Action class and handles rotating atoms and shapes.constructor = new Function RotateAction(Array ps, Point dif, Point center)
prototype = _Action
- Array ps: the points to be edited, including atoms and shape points
- Number dif: the rotation angle
Unit: radians - Point center: the center of rotation
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.SwitchContentAction
is a child of the Action class and handles switching the current content with a new Molecules and Shapes in the sketcher.constructor = new Function SwitchContentAction(SketcherCanvas sketcher)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Array beforeMols: the molecules present before the switch
- Array beforeShapes: the shapes present before the switch
- Array molsA: the molecules present after the switch
- Array shapesA: the shapes present after the switch
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.SwitchMoleculeAction
is a child of the Action class and handles switching the current content with a new Molecule in the sketcher.constructor = new Function SwitchMoleculeAction(SketcherCanvas sketcher)
prototype = _Action
- SketcherCanvas sketcher: the sketcher that this action is associated with
- Array beforeMols: the molecules present before the switch
- Array beforeShapes: the shapes present before the switch
- Molecule molA: the molecule replacing the current content
- override Function innerforward(): implements the forward action
- override Function innerreverse(): implements the reverse action
ChemDoodle.uis.actions.HistoryManager
this class manages actions and the undo/redo stacks for a sketcher.constructor = new Function HistoryManager(SketcherCanvas sketcher)
- SketcherCanvas sketcher: the associated sketcher
- Array undo: the Array of Action objects that acts as the undo stack
- Array redo: the Array of Action objects that acts as the redo stack
- Function clear(): clears the history and resets the undo and redo stacks
- Function pushUndo(_Action a): adds the input Action to the undo stack, performs its forward action and clears the redo stack
- Function redo(): if possible, redoes the last action
- Function undo(): if possible, undoes the last action
ChemDoodle.uis.gui
this package contains any gui components for the sketcher.ChemDoodle.uis.gui.desktop
this package contains any gui components for the desktop sketcher and 3D editor, usually created with jQuery UI.ChemDoodle.uis.gui.desktop.CursorManager
this class organizes and manages cursors for the UIs. Cursors are only defined for non-mobile instances of the UIs.constructor = new Function CursorManager(SketcherCanvas sketcher)
- String POINTER: the "pointer" cursor
- String CROSSHAIR: the "crosshair" cursor
- String TEXT: the "text" cursor
- String HAND_OPEN: the "hand_open" cursor
- String HAND_CLOSE: the "hand_close" cursor
- String HAND_POINT: the "hand_point" cursor
- String LASSO: the "lasso" cursor
- String ROTATE: the "rotate" cursor
- String RESIZE: the "resize" cursor
- String ERASER: the "eraser" cursor
- Function getCursor(): returns the current cursor value
returns String - Function setCursor(String cursor): sets the current cursor to the registered UI. This may be any of the static cursors defined by this class, or any valid CSS cursor type.
- Function setPreviousCursor(): sets the current cursor to the previously defined cursor
ChemDoodle.uis.gui.desktop.Button
this class defines jQuery UI buttons for the sketcher.constructor = new Function Button(String id, String icon, String tooltip, Function func)
- String id: a unique HTML id for this element in the HTML document
- String icon: the PNG icon in Base64 encoding
- String tooltip: the HTML tooltip (used in title attribute) for the button
- Function func: the function to be executed when this button is clicked
- Boolean toggle: defines this button as a toggle button in a group or not
Default Value: false
Unit: true/false - Function disable(): disables the button
- Function enable(): enables the button
- Function getElement(): returns the jQuery wrapper around the core HTML element
returns Object - Function getLabelElement(): returns the jQuery wrapper around the core HTML element of the label for this button if it is a radio button, otherwise it returns undefined
returns Object - Function getSource(String buttonGroup): returns the HTML source used to create this element
returns String - Function select(): selects the button
- Function setup(Boolean lone): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.ButtonSet
this class defines jQuery UI button sets for the sketcher.constructor = new Function ButtonSet(String id)
- String id: a unique HTML id for this element in the HTML document
- Array buttons: an Array of Button objects that this set contains
- Boolean toggle: defines this button set as a toggle button set in a group or not
Default Value: false
Unit: true/false - Number columnCount: if set from -1, the buttons will be layed out individually in a grid with the column count as assigned
Default Value: -1
Unit: Positive Integer - Function addDropDown(String tooltip): adds a DropDown component to this button set
- Function getElement(): returns the jQuery wrapper around the core HTML element
returns Object - Function getSource(String buttonGroup): returns the HTML source used to create this element
returns String - Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.ColorPicker
this class defines color pickers for the 3D editor stylesDialog. Uses jquery-simple-color.constructor = new Function ColorPicker(String id, String tooltip, Function func)
- String id: a unique HTML id for this element in the HTML document
- String tooltip: the HTML tooltip, used to describe the picker
- Function func: the function to be executed when the color is changed
- Function getElement(): returns the jQuery wrapper around the core HTML element
returns Object - Function getSource(): returns the HTML source used to create this element
returns String - Function setColor(String color): sets the currently selected color on the picker.
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.CheckBox
a child of the button class, this defines checkboxes for the 3D editor stylesDialog.constructor = new Function CheckBox(String id, String tooltip, Function func, Boolean checked)
- Boolean checked: tracks whether the box is currently checked or not
Default Value: false
Unit: true/false - Function check(): sets the checkbox as checked
- Function getSource(): returns the HTML source used to create this element
returns String - Function uncheck(): unchecks the checkbox
ChemDoodle.uis.gui.desktop.DummyButton
this class is a child of the Button class defines the dummy buttons associated with DropDown objects.constructor = new Function DummyButton(String id, String tooltip)
prototype = Button
- String id: a unique HTML id for this element in the HTML document
- String tooltip: the HTML tooltip (used in title attribute) for the button
- Boolean toggle: defines this button as a toggle button in a group or not
Default Value: false
Unit: true/false - Function func: the function to be executed when this button is clicked, this gets absorbed from a child button
Default Value: undefined - Function absorb(Button button): absorbs the parameter button to mimick it and match its function
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.DropDown
this class defines drop down components for the sketcher.constructor = new Function DropDown(String id, String tooltip, DummyButton dummy)
- String id: a unique HTML id for this element in the HTML document
- String tooltip: the tooltip for this drop down group
- DummyButton dummy: the dummy button that this drop down is linked to
- ButtonSet buttonSet: the button set that contains this drop down's children
- Button defaultButton: the default button, if this isn't set, the default button is the first declared button in the buttonset
Default Value: undefined - Function getButtonSource(): returns the HTML source used to create this element's drop down button
returns String - Function getHiddenSource(): returns the HTML source used to create this element's hidden button set
returns String - Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.Tray
this class defines sticky tray components for the sketcher floating palette.constructor = new Function Tray(SketcherCanvas sketcher, String id, DummyButton dummy, Number columnCount)
- SketcherCanvas sketcher: the sketcher of the floating toolbar this tray is attached to is associated with
- String id: a unique HTML id for this element in the HTML document
- String tooltip: the tooltip for this drop down group
- DummyButton dummy: the dummy button that this tray is linked to
- Number columnCount: the number of columns the buttonset for this tray is partitioned into
- ButtonSet buttonSet: the button set that contains this tray's children
- Button defaultButton: the default button, if this isn't set, the default button is the first declared button in the buttonset
Default Value: undefined - Function close(): closes this tray
- Function getSource(String buttonGroup): returns the HTML source used to create this tray in the DOM; the buttonGroup the dummyButton is set to must be provided
returns String - Function open(Button select): opens this tray, closing any other associated with the same sketcher; if the select parameter is provided, that button is selected in the tray and absorbed to the dummy button (it must be a member of the tray)
- Function reposition(): positions this tray in the appropriate location around the floating palette it is associated with
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.FloatingToolbar
this class defines a floating palette of buttons and trays.constructor = new Function FloatingToolbar(SketcherCanvas sketcher)
prototype = Button
- SketcherCanvas sketcher: the sketcher this floating toolbar is associated with
- Function getElement(): returns the jQuery wrapper around the core HTML element
returns Object - Function getSource(String buttonGroup): returns the HTML source used to create this floating toolbar in the DOM; the buttonGroup the contents must be provided
returns String - Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.TextButton
a child of the button class, this defines buttons with text labels instead of icons.constructor = new Function TextButton(String id, String tooltip, Function func, Boolean checked)
- Function check(): sets the button as checked
- Function getSource(): returns the HTML source used to create this element
returns String - Function uncheck(): removes checked property
ChemDoodle.uis.gui.desktop.TextInput
this defines a text field which is used to receive input from the user. The text field automatically resizes to fit content and matches input fonts. (Proprietary Only)constructor = new Function TextInput(SketcherCanvas sketcher, String id)
- SketcherCanvas sketcher: the sketcher this text field is associated with
- String id: a unique HTML id for this element in the HTML document
- Function close(Event e): closes the text field, if the Event is provided, the TextInput state is called to set the new label to the atom
- Function getElement(): returns the jQuery wrapper around the core HTML element
returns Object - Function getSource(): returns the HTML source used to create this element
returns String - Function getValue(): returns the value of the text field
returns String - Function measureTextWidth(String text): returns the width of the input text based on the settings of the text field
- Function resize(): resizes the text field to fit its current text value
- Function setup(): sets up the HTML with jQuery UI
- Function show(Number left, Number top, String val): shows this text field at the location of the hovered atom in the sketcher coordinate space provided by the left and top parameters, and populated with the input val parameter
ChemDoodle.uis.gui.desktop.Dialog
this class defines jQuery UI dialogs for the sketcher.constructor = new Function Dialog(String sketcherid, String subid, String title)
- String sketcherid: the id of the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: Information - Object buttons: the jQuery UI definition for the buttons in the dialog
Default Value: undefined - String message: the message to be displayed at the top of the dialog
Default Value: undefined - String afterMessage: the message to be displayed at the bottom of the dialog
Default Value: undefined - Boolean includeTextArea: defines whether this dialog should contain a text area
Default Value: false
Unit: true/false - Boolean includeTextField: defines whether this dialog should contain a text field
Default Value: false
Unit: true/false - Function getElement(): returns the jQuery wrapper around the core HTML element
returns Object - Function getTextArea(): returns the jQuery wrapper around the core HTML element used to represent this dialog's text area
returns Object - Function getTextField(): returns the jQuery wrapper around the core HTML element used to represent this dialog's text field
returns Object - Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.AtomQueryDialog
this class is a child of the Dialog class and defines the atom query window for the sketcher.constructor = new Function AtomQueryDialog(SketcherCanvas sketcher, String subid)
prototype = Dialog
- String sketcherid: the id of the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: Atom Query - Function setAtom(Atom a): resets the form to the input atom's query, or the defaults if no query is set
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.BondQueryDialog
this class is a child of the Dialog class and defines the bond query window for the sketcher.constructor = new Function BondQueryDialog(SketcherCanvas sketcher, String subid)
prototype = Dialog
- String sketcherid: the id of the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: Bond Query - Function setBond(Bond b): resets the form to the input bond's query, or the defaults if no query is set
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.MolGrabberDialog
this class is a child of the Dialog class and defines the search dialog for the sketcher.constructor = new Function MolGrabberDialog(String sketcherid, String subid)
prototype = Dialog
- String sketcherid: the id of the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: MolGrabber - Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.SaveFileDialog
this class is a child of the Dialog class and defines the save file dialog for the sketcher.constructor = new Function SaveFileDialog(String sketcherid, String subid)
prototype = Dialog
- String sketcherid: the id of the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: Save File - Function clear(): resets the download link
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.TemplateDialog
this class is a child of the Dialog class and defines the template dialog for the sketcher. The template dialog is similar to the Templates widget from the desktop software and will automatically populate based on the templateDepot data.constructor = new Function TemplateDialog(SketcherCanvas sketcher, String subid)
prototype = Dialog
- SketcherCanvas sketcher: the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: Save File - Function loadTemplate(Number g: the index of the template group in the templateDepot object, Number t: the index of the template in its group in the templateDepot object, Boolean changeState: if true, the state of the sketcher will be changed to the template state for drawing): load the specified template into the template widget for selection and drawing
- Function populate(): populates the template data when called by the sketcher
- Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.PeriodicTableDialog
this class is a child of the Dialog class and defines the periodic table dialog for the sketcher.constructor = new Function PeriodicTableDialog(SketcherCanvas sketcher, String subid)
prototype = Dialog
- SketcherCanvas sketcher: the sketcher this dialog is associated with
- String subid: a unique HTML id for this button element in the HTML document
- String title: the title of the dialog
Default Value: Periodic Table - Function setup(): sets up the HTML with jQuery UI
ChemDoodle.uis.gui.desktop.Popover
this class defines jQuery UI dialogs for the sketcher. Popovers are modal and only 1 can be shown at any time for a given SketcherCanvas.constructor = new Function Popover(SketcherCanvas sketcher, String id, Boolean free, Function onclose)
- SketcherCanvas sketcher: the sketcher this popover is associated with
- String id: a unique HTML id for this button element in the HTML document
- Boolean free: if true, this popover will appear above the provided event in the show function; if false, this popover will slide down from the top of the sketcher
Default Value: false
Unit: true/false - Function onclose: this function is called when the popover closes, if set
Default Value: undefined - Function close(Boolean cancel): closes the popover; the optional boolean parameter is set to true if it is closed by a click on the sketcher, to notify the onclose message that it was cancelled
- Function getHiddenSource(): returns the HTML source of the element of this popover
returns String - Function setup(): sets up the HTML of this popover
- Function show(Event e): shows the popover; if this popover is free then the Event e must be provided to give a location for the popover to appear
ChemDoodle.uis.gui.desktop.EnhancedStereoPopover
this class is a child of the Popover class and defines the enhanced stereochmemistry defintion input popover for the sketcher. This popover allows the user to define enhanced stereochemistry operators for the hovered atom.constructor = new Function EnhancedStereoPopover(SketcherCanvas sketcher, String id)
prototype = Popover
- SketcherCanvas sketcher: the sketcher this popover is associated with
- String id: a unique HTML id for this button element in the HTML document
- Function getContentSource(): sets up the inner HTML of this popover
- Function populate(Atom atom: the atom this popover will be affecting): Populate the value of the isotope number field in this popover using the current value of the atom parameter.
- Function setupContent(): defines the JavaScript behavior of the component
ChemDoodle.uis.gui.desktop.ImplicitHydrogenPopover
this class is a child of the Popover class and defines the implicit hydrogen count input popover for the sketcher. This popover allows the user to define an integer implicit hydrogen count value for the hovered atom.constructor = new Function ImplicitHydrogenPopover(SketcherCanvas sketcher, String id)
prototype = Popover
- SketcherCanvas sketcher: the sketcher this popover is associated with
- String id: a unique HTML id for this button element in the HTML document
- Function getContentSource(): sets up the inner HTML of this popover
- Function populate(Atom atom: the atom this popover will be affecting): Populate the value of the isotope number field in this popover using the current value of the atom parameter.
- Function setupContent(): defines the JavaScript behavior of the component
ChemDoodle.uis.gui.desktop.IsotopePopover
this class is a child of the Popover class and defines the isotope value input popover for the sketcher. This popover allows the user to define an integer isotope value for the hovered atom.constructor = new Function IsotopePopover(SketcherCanvas sketcher, String id)
prototype = Popover
- SketcherCanvas sketcher: the sketcher this popover is associated with
- String id: a unique HTML id for this button element in the HTML document
- Function getContentSource(): sets up the inner HTML of this popover
- Function populate(Atom atom: the atom this popover will be affecting): Populate the value of the isotope number field in this popover using the current value of the atom parameter.
- Function setupContent(): defines the JavaScript behavior of the component
ChemDoodle.uis.gui.desktop.DialogManager
this class organizes and manages dialogs for the sketcher.constructor = new Function DialogManager(SketcherCanvas sketcher)
- SketcherCanvas sketcher: the associated sketcher
- Dialog saveDialog: the save dialog
- AtomQueryDialog atomQueryDialog: the atom query dialog
- BondQueryDialog bondQueryDialog: the bond query dialog
- TemplateDialog templateDialog: the template dialog
- Dialog searchDialog: the search dialog
- PeriodicTableDialog periodicTableDialog: the Periodic Table dialog
- Dialog calculateDialog: the calculate dialog
- Dialog inputDialog: the input dialog
- Popover openPopup: the popover for file content input
- EnhancedStereoPopover enhancedStereoPopup: the popover for enhanced stereochemistry definitions
- ImplicitHydrogenPopover implicitHydrogenPopup: the popover for implicit hydrogen count input
- IsotopePopover isotopePopup: the popover for isotope input
- Function makeOtherDialogs(SketcherCanvas sketcher): Implement this function in your extension to the dialog manager to create your own dialogs
ChemDoodle.uis.gui.desktop.ToolbarManager
this class organizes and manages the toolbars for the sketcher.constructor = new Function ToolbarManager(SketcherCanvas sketcher)
- SketcherCanvas sketcher: the associated sketcher
- Button buttonOpen: the open button
- Button buttonSave: the save button
- Button buttonSearch: the search button
- Button buttonCalculate: the calculate button
- Button buttonMove: the move button
- Button buttonErase: the erase button
- Button buttonClear: the clear button
- Button buttonClean: the clean button
- Button buttonQuery: the query button
- ButtonSet scaleSet: the scale button set
- Button buttonScalePlus: the zoom in button
- Button buttonScaleMinus: the zoom out button
- ButtonSet lassoSet: the lasso button set
- Button buttonLasso: the lasso button
- ButtonSet historySet: the history button set
- Button buttonUndo: the undo button
- Button buttonRedo: the redo button
- ButtonSet labelSet: the label button set
- Button buttonLabel: the label button
- ButtonSet bondSet: the bond button set
- Button buttonSingle: the single bond button
- Button buttonRecessed: the recessed bond button
- Button buttonProtruding: the protruding bond button
- Button buttonDouble: the double bond button
- Button buttonBond: the bond button
- ButtonSet ringSet: the ring button set
- Button buttonCyclohexane: the cyclohexane button
- Button buttonBenzene: the benzene button
- Button buttonRing: the ring button
- ButtonSet attributeSet: the attribute button set
- Button buttonAttribute: the attribute button
- ButtonSet shapeSet: the shape button set
- Button buttonShape: the shape button
- Function makeAttributeSet(ToolbarManager self): creates the attribute button set, sending the function itself
- Function makeBondSet(ToolbarManager self): creates the bond button set, sending the function itself
- Function makeFlipSet(ToolbarManager self): creates the horizontal and vertical flip button set, sending the function itself
- Function makeHistorySet(ToolbarManager self): creates the history button set, sending the function itself
- Function makeLabelSet(ToolbarManager self): creates the label button set, sending the function itself
- Function makeLassoSet(ToolbarManager self): creates the lasso button set, sending the function itself
- Function makeRingSet(ToolbarManager self): creates the ring button set, sending the function itself
- Function makeScaleSet(ToolbarManager self): creates the scale button set, sending the function itself
- Function makeShapeSet(ToolbarManager self): creates the shape button set, sending the function itself
- Function setup(): sets up the HTML with jQuery UI
- Function write(): collects all the HTML source for the toolbar and creates it in the DOM
- optional abstract Function makeOtherButtons(ToolbarManager self): Implement this function in your extension to the toolbar manager to create your own buttons
ChemDoodle.uis.gui.desktop.stylesDialog
this class is a child of the Dialog class and defines the visual specifications dialog for the Editor.constructor = new Function stylesDialog(EditorCanvas3D editor, String subid)
prototype = Dialog
- EditorCanvas3D editor: the EditorCanvas3D this dialog is associated with
- String subid: a unique HTML id for this dialog element in the HTML document
- String title: the title of the dialog
Default Value: Visual Specifications - Function makeAtomColorSet(stylesDialog self): creates the atom color button set, sending the function itself
- Function makeBondColorSet(stylesDialog self): creates the bond color button set, sending the function itself
- Function makeCompassPositionSet(stylesDialog self): creates the compass position button set, sending the function itself
- Function makeFogModeSet(stylesDialog self): creates the fog mode button set, sending the function itself
- Function makeProjectionSet(stylesDialog self): creates the projection button set, sending the function itself
- Function setup(stylesDialog self, EditorCanvas3D editor): writes and sets up the HTML with jQuery UI, sending the function itself and its canvas
- Function update(Styles styles): updates the state of dialog elements with the given visual specifications
ChemDoodle.uis.gui.desktop.ToolbarManager3D
this class organizes and manages the toolbars for the editor.constructor = new Function ToolbarManager3D(EditorCanvas3D editor)
- EditorCanvas3D editor: the associated editor
- Button buttonOpen: the open button
- Button buttonSave: the save button
- Button buttonSearch: the search button
- Button buttonCalculate: the calculate button
- Button buttonTransform: the transform button
- Button buttonSettings: the settings button
- Button buttonAnimation: the animation button
- Button buttonClear: the clear button
- Button buttonClean: the clean button
- Function makeHistorySet(ToolbarManager3D self): creates the history button set, sending the function itself
- Function makeMeasurementsSet(ToolbarManager3D self): creates the shape button set, sending the function itself
- Function makeScaleSet(ToolbarManager3D self): creates the scale button set, sending the function itself
- Function setup(): sets up the HTML with jQuery UI
- Function write(): collects all the HTML source for the toolbar and creates it in the DOM
ChemDoodle.uis.gui.imageDepot
this package stores the sketcher icons and images as data URIs. Please note that these images are iChemLabs Proprietary and may only be used in projects using ChemDoodle Web Components.- static String ADD_LONE_PAIR: the "ADD_LONE_PAIR" icon encoded as a Base64 string
- static String ADD_RADICAL: the "ADD_RADICAL" icon encoded as a Base64 string
- static String ARROW_DOWN: the group button expansion icon encoded as a Base64 string
- static String ARROW_EQUILIBRIUM: the "ARROW_EQUILIBRIUM" icon encoded as a Base64 string
- static String ARROW_RESONANCE: the "ARROW_RESONANCE" icon encoded as a Base64 string
- static String ARROW_RETROSYNTHETIC: the "ARROW_RETROSYNTHETIC" icon encoded as a Base64 string
- static String ARROW_SYNTHETIC: the "ARROW_SYNTHETIC" icon encoded as a Base64 string
- static String BENZENE: the "BENZENE" icon encoded as a Base64 string
- static String BOND_ANY: the "BOND_ANY" icon encoded as a Base64 string
- static String BOND_DOUBLE: the "BOND_DOUBLE" icon encoded as a Base64 string
- static String BOND_DOUBLE_AMBIGUOUS: the "BOND_DOUBLE_AMBIGUOUS" icon encoded as a Base64 string
- static String BOND_HALF: the "BOND_HALF" icon encoded as a Base64 string
- static String BOND_PROTRUDING: the "BOND_PROTRUDING" icon encoded as a Base64 string
- static String BOND_QUADRUPLE: the "BOND_QUADRUPLE" icon encoded as a Base64 string
- static String BOND_QUINTUPLE: the "BOND_QUINTUPLE" icon encoded as a Base64 string
- static String BOND_RECESSED: the "BOND_RECESSED" icon encoded as a Base64 string
- static String BOND_RESONANCEF: the "BOND_RESONANCE" icon encoded as a Base64 string
- static String BOND_SEXTUPLE: the "BOND_SEXTUPLE" icon encoded as a Base64 string
- static String BOND_SINGLE: the "BOND_SINGLE" icon encoded as a Base64 string
- static String BOND_TRIPLE: the "BOND_TRIPLE" icon encoded as a Base64 string
- static String BOND_ZERO: the "BOND_ZERO" icon encoded as a Base64 string
- static String BROMINE: the "BROMINE" icon encoded as a Base64 string
- static String CALCULATE: the "CALCULATE" icon encoded as a Base64 string
- static String CARBON: the "CARBON" icon encoded as a Base64 string
- static String CHARGE_BRACKET: the "CHARGE_BRACKET" icon encoded as a Base64 string
- static String CHLORINE: the "CHLORINE" icon encoded as a Base64 string
- static String CLEAR: the "CLEAR" icon encoded as a Base64 string
- static String CYCLOBUTANE: the "CYCLOBUTANE" icon encoded as a Base64 string
- static String CYCLOHEPTANE: the "CYCLOHEPTANE" icon encoded as a Base64 string
- static String CYCLOHEXANE: the "CYCLOHEXANE" icon encoded as a Base64 string
- static String CYCLOOCTANE: the "CYCLOOCTANE" icon encoded as a Base64 string
- static String CYCLOPENTANE: the "CYCLOPENTANE" icon encoded as a Base64 string
- static String CYCLOPROPANE: the "CYCLOPROPANE" icon encoded as a Base64 string
- static String DECREASE_CHARGE: the "DECREASE_CHARGE" icon encoded as a Base64 string
- static String ERASE: the "ERASE" icon encoded as a Base64 string
- static String FLUORINE: the "FLUORINE" icon encoded as a Base64 string
- static String HYDROGEN: the "HYDROGEN" icon encoded as a Base64 string
- static String INCREASE_CHARGE: the "INCREASE_CHARGE" icon encoded as a Base64 string
- static String IODINE: the "IODINE" icon encoded as a Base64 string
- static String LASSO: the "LASSO" icon encoded as a Base64 string
- static String LASSO_SHAPES: the "LASSO_SHAPES" icon encoded as a Base64 string
- static String MARQUEE: the "MARQUEE" icon encoded as a Base64 string
- static String MOVE: the "MOVE" icon encoded as a Base64 string
- static String NITROGEN: the "NITROGEN" icon encoded as a Base64 string
- static String OPEN: the "OPEN" icon encoded as a Base64 string
- static String OPTIMIZE: the "OPTIMIZE" icon encoded as a Base64 string
- static String OXYGEN: the "OXYGEN" icon encoded as a Base64 string
- static String PERIODIC_TABLE: the "PERIODIC_TABLE" icon encoded as a Base64 string
- static String PHOSPHORUS: the "PHOSPHORUS" icon encoded as a Base64 string
- static String PUSHER_BOND_FORMING: the "PUSHER_BOND_FORMING" icon encoded as a Base64 string
- static String PUSHER_DOUBLE: the "PUSHER_DOUBLE" icon encoded as a Base64 string
- static String PUSHER_SINGLE: the "PUSHER_SINGLE" icon encoded as a Base64 string
- static String QUERY: the "QUERY" icon encoded as a Base64 string
- static String REDO: the "REDO" icon encoded as a Base64 string
- static String REMOVE_LONE_PAIR: the "REMOVE_LONE_PAIR" icon encoded as a Base64 string
- static String REMOVE_RADICAL: the "REMOVE_RADICAL" icon encoded as a Base64 string
- static String SAVE: the "SAVE" icon encoded as a Base64 string
- static String SEARCH: the "SEARCH" icon encoded as a Base64 string
- static String SULFUR: the "SULFUR" icon encoded as a Base64 string
- static String UNDO: the "UNDO" icon encoded as a Base64 string
- static String ZOOM_IN: the "ZOOM_IN" icon encoded as a Base64 string
- static String ZOOM_OUT: the "ZOOM_OUT" icon encoded as a Base64 string
- static Function getURI(String s): given the String parameter of a Base64 encoded PNG image, returns the correctly formatted data URI to be used as an image in HTML
returns String
ChemDoodle.uis.states
this package contains all State classes. States define how the sketcher behaves at any given point, usually associated with input events and button presses.ChemDoodle.uis.states._State
is the parent class for states associated with the sketcher. Its basic functionality allows defines the behavior of the sketcher.constructor = new Function _State()
- SketcherCanvas sketcher: the sketcher that this state defines behavior for
- Boolean dontTranslateOnDrag: if set to true, the the transform actions won't be executed on drag events
- Function click(Event e): handles the click event for the sketcher
- Function dblclick(Event e): handles the dblclick event for the sketcher
- Function drag(Event e): handles the drag event for the sketcher
- Function enter(): this method gets called when a state is entered
- Function exit(): this method gets called when a state is exited
- Function findHoveredObject(Event sketcher, Boolean includeAtoms, Boolean includeBonds, Boolean includeShapes): finds the closest hovered object to the input event point, in the set permitted by the parameter booleans
- Function getOptimumAngle(Atom a, Boolean bondOrder): finds the optimal angle to grow bonds from the input sprout atom; provide a bondOrder to be set for better placement
- Function keydown(Event e): handles the keydown event for the sketcher
- Function keypress(Event e): handles the keypress event for the sketcher
- Function keyup(Event e): handles the keyup event for the sketcher
- Function mousedown(Event e): handles the mousedown event for the sketcher
- Function mousemove(Event e): handles the mousemove event for the sketcher
- Function mouseout(Event e): handles the mouseout event for the sketcher
- Function mouseover(Event e): handles the mouseover event for the sketcher
- Function mouseup(Event e): handles the mouseup event for the sketcher
- Function mousewheel(Event e): handles the mousewheel event for the sketcher
- Function placeRequiredAtom(Event e): allows the automatic placement of required atoms to satisfy a false value for the requireStartingAtom sketcher option
- Function removeStartAtom(): hides the start atom
- Function rightclick(Event e): handles the rightclick event for the sketcher
- Function rightmousedown(Event e): handles the rightmousedown event for the sketcher
- Function rightmouseup(Event e): handles the rightmouseup event for the sketcher
- Function setup(SketcherCanvas sketcher): called by child State classes as a super method in the constructor
- optional abstract Function draw(Context ctx, Styles styles): draws additional graphics to the sketcher as metadata for the state
- optional abstract Function innerclick(Event e): called by the click function, handled by child
- optional abstract Function innerdblclick(Event e): called by the dblclick function, handled by child
- optional abstract Function innerdrag(Event e): called by the drag function, handled by child
- optional abstract Function innerenter(): called by the enter function, handled by child
- optional abstract Function innerexit(): called by the exit function, handled by child
- optional abstract Function innerkeydown(Event e): called by the keydown function, handled by child
- optional abstract Function innerkeypress(Event e): called by the keypress function, handled by child
- optional abstract Function innerkeyup(Event e): called by the keyup function, handled by child
- optional abstract Function innermousedown(Event e): called by the mousedown function, handled by child
- optional abstract Function innermousemove(Event e): called by the mousemove function, handled by child
- optional abstract Function innermouseout(Event e): called by the mouseout function, handled by child
- optional abstract Function innermouseover(Event e): called by the mouseover function, handled by child
- optional abstract Function innermouseup(Event e): called by the mouseup function, handled by child
- optional abstract Function innermousewheel(Event e): called by the mousewheel function, handled by child
- optional abstract Function innerrightclick(Event e): called by the rightclick function, handled by child
- optional abstract Function innerrightmousedown(Event e): called by the rightmousedown function, handled by child
- optional abstract Function innerrightmouseup(Event e): called by the rightmouseup function, handled by child
ChemDoodle.uis.states.ChargeState
is a child of the State class and defines behavior for the sketcher to modify the charge on an atom.constructor = new Function ChargeState(SketcherCanvas sketcher)
prototype = _State
- Number delta: the change in charge to be used for actions
Default Value: 1 - override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.RepeatUnitState
is a child of the State class and defines behavior for the sketcher to draw repeat units for repeating groups.constructor = new Function RepeatUnitState(SketcherCanvas sketcher)
prototype = _State
- override Function dblclick(Event e): overrides the double click event
- override Function draw(Context ctx): draws additional metadata
- override Function innerdrag(Event e): handles the drag event
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.EraseState
is a child of the State class and defines behavior for the sketcher to erase content.constructor = new Function EraseState(SketcherCanvas sketcher)
prototype = _State
- Function handleDelete(): handles the delete functionality
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.LabelState
is a child of the State class and defines behavior for the sketcher to modify the atom label.constructor = new Function LabelState(SketcherCanvas sketcher)
prototype = _State
- String label: the label used for actions
Default Value: C - override Function innermousedown(Event e): handles the mousedown event
- override Function innermousedrag(Event e): handles the mousedrag event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.LassoState
is a child of the State class and defines behavior for the sketcher when using the lasso.constructor = new Function LassoState(SketcherCanvas sketcher)
prototype = _State
- override Function draw(Context ctx): draws additional metadata
- override Function innerclick(Event e): handles the click event
- override Function innerdblclick(Event e): handles the dblclick event
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousedrag(Event e): handles the mousedrag event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.LonePairState
is a child of the State class and defines behavior for the sketcher to modify the number of lone pairs on an atom.constructor = new Function LonePairState(SketcherCanvas sketcher)
prototype = _State
- Number delta: the change in the number of lone pairs to be used for actions
Default Value: 1 - override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.MoveState
is a child of the State class and defines behavior for the sketcher to move content.constructor = new Function MoveState(SketcherCanvas sketcher)
prototype = _State
- _Action action: this is the current action, the state keeps track of it during a drag event
Default Value: undefined - override Function innerdrag(Event e): handles the drag event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.NewBondState
is a child of the State class and defines behavior for the sketcher when using the bond tools.constructor = new Function NewBondState(SketcherCanvas sketcher)
prototype = _State
- Integer bondOrder: the bond order to be applied
Default Value: 1 - String stereo: the bond stereo to be applied
Default Value: ChemDoodle.structures.Bond.STEREO_NONE - Function incrementBondOrder(Bond b): increments a bond order
- override Function innerclick(Event e): handles the click event
- override Function innerdrag(Event e): handles the drag event
- override Function innerexit(): handles the state exit
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseout(Event e): handles the mouseout event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.NewChainState
is a child of the State class and defines behavior for the sketcher when using the chain tools.constructor = new Function NewChainState(SketcherCanvas sketcher)
prototype = _State
- Function getChain(Atom pivot, Point end): returns an Array of Atom representing the requested chain to be formed based on the input parameters around an Atom
returns Array - override Function innerclick(Event e): handles the click event
- override Function innerdrag(Event e): handles the drag event
- override Function innerexit(): handles the state exit
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseout(Event e): handles the mouseout event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.NewRingState
is a child of the State class and defines behavior for the sketcher when using the ring tools.constructor = new Function NewRingState(SketcherCanvas sketcher)
prototype = _State
- Integer numSides: the number of bonds in the ring to be applied; if this value is -1, the tool will be in arbitrary ring size mode
Default Value: 6 - String unsaturated: this defines whether created rings will be saturated or not
Default Value: false
Unit: true/false - Function getOptimalRing(Bond b, Integer numSides): returns an Array of Atom representing the requested ring to be formed based on the input parameters around a Bond
returns Array - Function getRing(Atom a, Integer numSides, Number bondLength, Number angle, Boolean setOverlaps): returns an Array of Atom representing the requested ring to be formed based on the input parameters around an Atom
returns Array - override Function innerclick(Event e): handles the click event
- override Function innerdrag(Event e): handles the drag event
- override Function innerexit(): handles the state exit
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseout(Event e): handles the mouseout event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.NewTemplateState
is a child of the State class and defines behavior for the sketcher when using the chain tools.constructor = new Function NewTemplateState(SketcherCanvas sketcher)
prototype = _State
- Object template: the template that is being drawn in ChemDoodle JSON format
- Integer attachPos: the index of the atom in the template that is used for attachment when drawing
Default Value: -1 - Function getTemplate(Point p): returns a molecule formed from the template based on the input parameters around an Atom
returns Molecule - override Function innerclick(Event e): handles the click event
- override Function innerdrag(Event e): handles the drag event
- override Function innerexit(): handles the state exit
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseout(Event e): handles the mouseout event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.PusherState
is a child of the State class and defines behavior for the sketcher to draw electron pushing arrows. This state is also used to define reaction atom mappings, if numElectron is -10.constructor = new Function PusherState(SketcherCanvas sketcher)
prototype = _State
- Number numElectron: the number of electrons to push to be used for actions
Default Value: 1 - override Function dblclick(Event e): overrides the double click event
- override Function draw(Context ctx): draws additional metadata
- override Function innerdrag(Event e): handles the drag event
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.QueryState
is a child of the State class and defines behavior for the sketcher to modify the query properties of an atom or bond.constructor = new Function QueryState(SketcherCanvas sketcher)
prototype = _State
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.RadicalState
is a child of the State class and defines behavior for the sketcher to modify the number of radicals on an atom.constructor = new Function RadicalState(SketcherCanvas sketcher)
prototype = _State
- Number delta: the change in the number of radicals to be used for actions
Default Value: 1 - override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.IsotopeState
is a child of the State class and defines behavior for the sketcher to modify the isotope value of an atom.constructor = new Function IsotopeState(SketcherCanvas sketcher)
prototype = _State
- override Function innerclick(Event e): handles the click event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.ShapeState
is a child of the State class and defines behavior for the sketcher to draw generic shapes.constructor = new Function ShapeState(SketcherCanvas sketcher)
prototype = _State
- static Number LINE: specifies a line
- static Number ARROW_SYNTHETIC: specifies a synthetic arrow
- static Number ARROW_RETROSYNTHETIC: specifies a retrosynthetic arrow
- static Number ARROW_RESONANCE: specifies a resonance arrow
- static Number ARROW_EQUILIBRIUM: specifies a equilibrium arrow
- static Number BRACKET: specifies a charge bracket
- Number shapeType: the type of Shape to be created
Default Value: LINE - override Function draw(Context ctx): draws additional metadata
- override Function innerdrag(Event e): handles the drag event
- override Function innerenter(): handles the state enter
- override Function innerexit(): handles the state exit
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.TextInputState
is a child of the State class and defines behavior for the sketcher when using the TextInput object for allowing users to enter custom atom labels. (Proprietary Only)constructor = new Function TextInputState(SketcherCanvas sketcher)
prototype = _State
- Function changeLabel(Event e): completes the atom label change after the TextInput object is closed; if the Event parameter is provided, a mousemove action will be called for that Event after the label is set
- override Function innerdrag(Event e): handles the drag event
- override Function innerexit(): handles the state exit
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states.VAPState
is a child of the State class and defines behavior for the sketcher to draw variable attachment points.constructor = new Function VAPState(SketcherCanvas sketcher)
prototype = _State
- override Function draw(Context ctx): draws additional metadata
- override Function findHoveredObject(Event e, Boolean includeAtoms, Boolean includeVAPsBonds, Boolean includeVAPsAsterisks): finds the closest hovered object to the input event point, as it pertains to the VAP state, overriding the default hover behavior
- override Function innerdrag(Event e): handles the drag event
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
- override Function innermouseup(Event e): handles the mouseup event
ChemDoodle.uis.states._State3D
is the parent class for states associated with the 3D Editor. Its basic functionality defines the behavior of the sketcher.constructor = new Function _State3D()
- EditorCanvas3D editor: the editor that this state defines behavior for
- Function click(Event e): handles the click event for the editor
- Function dblclick(Event e): handles the dblclick event for the editor
- Function drag(Event e): handles the drag event for the editor
- Function enter(): this method gets called when a state is entered
- Function exit(): this method gets called when a state is exited
- Function keydown(Event e): handles the keydown event for the editor
- Function keypress(Event e): handles the keypress event for the editor
- Function keyup(Event e): handles the keyup event for the editor
- Function mousedown(Event e): handles the mousedown event for the editor
- Function mousemove(Event e): handles the mousemove event for the editor
- Function mouseout(Event e): handles the mouseout event for the editor
- Function mouseover(Event e): handles the mouseover event for the editor
- Function mouseup(Event e): handles the mouseup event for the editor
- Function mousewheel(Event e): handles the mousewheel event for the editor
- Function rightclick(Event e): handles the rightclick event for the editor
- Function rightmousedown(Event e): handles the rightmousedown event for the editor
- Function rightmouseup(Event e): handles the rightmouseup event for the editor
- Function setup(SketcherCanvas sketcher): called by child State classes as a super method in the constructor
- optional abstract Function innerclick(Event e): called by the click function, handled by child
- optional abstract Function innerdblclick(Event e): called by the dblclick function, handled by child
- optional abstract Function innerdrag(Event e): called by the drag function, handled by child
- optional abstract Function innerenter(): called by the enter function, handled by child
- optional abstract Function innerexit(): called by the exit function, handled by child
- optional abstract Function innerkeydown(Event e): called by the keydown function, handled by child
- optional abstract Function innerkeypress(Event e): called by the keypress function, handled by child
- optional abstract Function innerkeyup(Event e): called by the keyup function, handled by child
- optional abstract Function innermousedown(Event e): called by the mousedown function, handled by child
- optional abstract Function innermousemove(Event e): called by the mousemove function, handled by child
- optional abstract Function innermouseout(Event e): called by the mouseout function, handled by child
- optional abstract Function innermouseover(Event e): called by the mouseover function, handled by child
- optional abstract Function innermouseup(Event e): called by the mouseup function, handled by child
- optional abstract Function innermousewheel(Event e): called by the mousewheel function, handled by child
- optional abstract Function innerrightclick(Event e): called by the rightclick function, handled by child
- optional abstract Function innerrightmousedown(Event e): called by the rightmousedown function, handled by child
- optional abstract Function innerrightmouseup(Event e): called by the rightmouseup function, handled by child
ChemDoodle.uis.states.ViewState3D
is a child of the State3D class and defines behavior for the editor when not in any other state.constructor = new Function ViewState3D(EditorCanvas3D editor)
prototype = _State3D
ChemDoodle.uis.states.MeasureState3D
is a child of the State3D class and defines behavior for the editor to measure distances, angles, and torsions between atoms.constructor = new Function MeasureState3D(EditorCanvas3D editor)
prototype = _State3D
- Array selectedAtoms: An array holding the selected atoms
- Function reset(): deselects all selected atoms and repaints the canvas
- override Function innerenter(): is called when the state is entered, calls reset
- override Function innerexit(): is called when the state is exited, calls reset
- override Function innermousedown(Event e): handles the mousedown event
- override Function innermousemove(Event e): handles the mousemove event
ChemDoodle.uis.states.StateManager
this class organizes and manages the states for the sketcher.constructor = new Function StateManager(SketcherCanvas sketcher)
- NewBondState STATE_NEW_BOND: the new bond state
- NewRingState STATE_NEW_RING: the new ring state
- NewChainState STATE_NEW_CHAIN: the new chain state
- ChargeState STATE_CHARGE: the charge state
- LonePairState STATE_LONE_PAIR: the lone pair state
- RadicalState STATE_RADICAL: the radical state
- IsotopeState STATE_ATTRIBUTE_INPUT: this state handles popover access for inputting attributes, such as enhanced stereochemistry, implicit hydrogen counts and isotope values
- MoveState STATE_MOVE: the move state
- EraseState STATE_ERASE: the erase state
- LabelState STATE_LABEL: the label state
- LassoState STATE_LASSO: the lasso state
- ShapeState STATE_SHAPE: the shape state
- PusherState STATE_PUSHER: the pusher state
- RepeatUnitState STATE_REPEAT_UNIT: the repeat unit state
- VAPState STATE_VAP: the variable attachment point state
- QueryState STATE_QUERY: the query state
- Function getCurrentState(): returns the current state.
returns _State - Function setState(_State nextState): sets the state, exiting the current state and entering the parameter state.
ChemDoodle.uis.states.StateManager3D
this class organizes and manages the states for the 3D Editor.constructor = new Function StateManager3D(EditorCanvas3D editor)
- ViewState3D STATE_VIEW: the view state
- MeasureState3D STATE_MEASURE: the measure state
- Function getCurrentState(): returns the current state.
returns _State - Function setState(_State nextState): sets the state, exiting the current state and entering the parameter state.
ChemDoodle.uis.templateDepot
this package stores the structure drawing templates, both default and user created, for the sketcher. Look at the source code for this object if you wish to add, remove or edit templates, as that is much more clear than this description. Please note that default templates are iChemLabs Proprietary and may only be used in projects using ChemDoodle Web Components. The templateDepot object is an Array that contains template groups. Template groups are Objects that contain a name variable and a templates Array variable. A template group's templates Array contains template objects. Template objects contain two variables, name and data. The name is displayed in the templates widget and does not need to be unique while the data object is the ChemDoodle JSON object of the template. When editing the templates, do not alter or remove the last template group, as that is the group that stores the user created templates from HTML5 localStorage.ChemDoodle.uis.tools
this package contains any tools that the sketcher uses to perform functions.ChemDoodle.uis.tools.Lasso
this class is the implementation of the lasso tool.constructor = new Function Lasso(SketcherCanvas sketcher)
- static String MODE_LASSO: specifies the standard lasso behavior
- static String MODE_LASSO_SHAPES: specifies the standard lasso behavior only for shapes
- static String MODE_RECTANGLE_MARQUEE: specifies the standard rectangular marquee behavior
- SketcherCanvas sketcher: the associated sketcher
- Array atoms: the lassoed atoms, if any
- Array shapes: the lassoed shapes, if any
- Bounds bounds: the bounds of the lassoed objects, if any, undefined otherwise
Default Value: undefined - String mode: the lasso mode, one of the static mode variables associated with this class
Default Value: MODE_LASSO - Array points: the array of points that holds the mouse outline when users are making a selection
- Function addPoint(Point p): manages the points array given the lasso mode and the input Point from the user
- Function draw(Context ctx, Styles styles): draws this lasso to the sketcher that owns the Context using the given Styles
- Function empty(): empties the lasso
- Function getAllPoints(): returns an Array of Point data structures including all the lassoed atoms and the points of all the lassoed shapes
returns Array - Function getBonds(): returns an Array of Bond data structures including all the bonds that are lassoed
returns Array - Function getFirstMolecule(): returns the Molecule that contains the first lassoed Atom; if no Atoms are lassoed, then undefined is returned
returns Molecule - Function isActive(): returns true if there is lassoed content, false otherwise
returns Boolean - Function select(Array atoms, Array shapes): selects the atoms and shapes based on the points Array and the associated sketcher. If atoms and shapes are provided, then those arrays become the new selection.
- Function selectNextMolecule(): if there are any molecules, the next molecule is selected based on the current selection; if no molecule is selected, the last drawn molecule is selected
- Function selectNextShape(): if there are any shapes, the next shape is selected based on the current selection; if no shape is selected, the last drawn shape is selected
- Function setBounds(): sets the bounds variable for the lasso based on lassoed content
- abstract Function enableButtons(): enables or disables toolbar buttons for the associated sketcher depending on the content that is lassoed.