Returns: true if HTML5 canvas is supported, false otherwise.
Parameters:
licenseURL - the URL of the license fileParameters:
source - molecule source in MDL molfile or null to apply an empty moleculeimageType - output image data stream MIME type (default value is "image/png").optionalSettings - JavaScript object that describes display settings.
The object contains key - value pairs.
| Key | Type | Values | Default value | Notes |
|---|---|---|---|---|
| "carbonLabelVisible" | Boolean | {true, false} | false | does not apply in "BALLSTICK" displaymode |
| "chiralFlagVisible" | Boolean | {true, false} | true | - |
| "valenceErrorVisible" | Boolean | {true, false} | true | - |
| "lonePairsVisible" | Boolean | {true, false} | false | - |
| "atomIndicesVisible" | Boolean | {true, false} | false | - |
| "atomMapsVisible" | Boolean | {true, false} | true | - |
| "cpkColoring" | Boolean | {true, false} | true | - |
| "displayMode" | String | {"WIREFRAME", "BALLSTICK", "STICK", "SPACEFILL"} | "WIREFRAME" | - |
| "implicitHydrogen" | String | {"ALL", "OFF", "HETERO", "TERMINAL_AND_HETERO"} | "TERMINAL_AND_HETERO" | If "carbonLabelVisible" value is true, "HETERO" and "TERMINAL_AND_HETERO" values will be considered as "ALL". |
| "backgroundColor" | String | css color | - | do not set this to leave it transparent (png) or white |
| "zoomMode" | String | {"fit", "autoshrink"} | "fit" | "fit" will expand every molecule to the given size, "autoshrink" scales down large molecules only. |
| "width" | Number | positive integer | 200 | - |
| "height" | Number | positive integer | 200 | - |
{
'carbonLabelVisible' : false,
'atomMapsVisible' : true,
'chiralFlagVisible' : true,
'valenceErrorVisible' : true,
'lonePairsVisible' : false,
'implicitHydrogen' : "TERMINAL_AND_HETERO",
'displayMode' : "WIREFRAME",
'backgroundColor' : "#ff00ff",
'width' : 300,
'height' : 350
}
Returns: image stream encoded as an image data URL if image width/height is greater than zero
Parameters:
source - molecule source in MRV or null to apply an empty moleculeimagType - output image data stream MIME type (default value is "image/png").optionalSettings - JavaScript object that describes display settings.
The object contains key - value pairs.
| Key | Type | Values | Default value | Notes |
|---|---|---|---|---|
| "carbonLabelVisible" | Boolean | {true, false} | false | does not apply in "BALLSTICK" displaymode |
| "chiralFlagVisible" | Boolean | {true, false} | true | - |
| "valenceErrorVisible" | Boolean | {true, false} | true | - |
| "lonePairsVisible" | Boolean | {true, false} | false | - |
| "atomIndicesVisible" | Boolean | {true, false} | false | - |
| "atomMapsVisible" | Boolean | {true, false} | true | - |
| "cpkColoring" | Boolean | {true, false} | true | - |
| "displayMode" | String | {"WIREFRAME", "BALLSTICK", "STICK", "SPACEFILL"} | "WIREFRAME" | - |
| "implicitHydrogen" | String | {"ALL", "OFF", "HETERO", "TERMINAL_AND_HETERO"} | "TERMINAL_AND_HETERO" | If "carbonLabelVisible" value is true, "HETERO" and "TERMINAL_AND_HETERO" values will be considered as "ALL". |
| "backgroundColor" | String | css color | - | do not set this to leave it transparent (png) or white |
| "zoomMode" | String | {"fit", "autoshrink"} | "fit" | "fit" will expand every molecule to the given size, "autoshrink" scales down large molecules only. |
| "width" | Number | positive integer | 200 | - |
| "height" | Number | positive integer | 200 | - |
{
"carbonLabelVisible" : false,
"atomMapsVisible" : true,
"chiralFlagVisible" : true,
"valenceErrorVisible" : true,
"lonePairsVisible" : false,
"implicitHydrogen" : "TERMINAL_AND_HETERO",
"displayMode" : "WIREFRAME",
"backgroundColor" : "#ff00ff",
"zoomMode" : autoshrink,
"width" : 300,
"height" : 350
}
Returns: image stream encoded as an image data URL if image width/height is greater than zero
Creates a new editor widget and inserts it into the body of the current page.
Creates a new editor widget and inserts it into the specified DOM element.
Parameters:
id - the ID of the DOM element whose child will be the editor widget.Returns: map of display setting is wrapped into a JavaScript object.
| Key | Type | Values | Default value | Notes |
|---|---|---|---|---|
| "carbonLabelVisible" | Boolean | {true, false} | false | does not apply in "BALLSTICK" displaymode |
| "chiralFlagVisible" | Boolean | {true, false} | true | - |
| "atomIndicesVisible" | Boolean | {true, false} | false | - |
| "atomMapsVisible" | Boolean | {true, false} | true | - |
| "cpkColoring" | Boolean | {true, false} | true | - |
| "valenceErrorVisible" | Boolean | {true, false} | true | - |
| "lonePairsVisible" | Boolean | {true, false} | false | - |
| "displayMode" | String | {"WIREFRAME", "BALLSTICK", "STICK", "SPACEFILL"} | "WIREFRAME" | - |
| "implicitHydrogen" | String | {"ALL", "OFF", "HETERO", "TERMINAL_AND_HETERO"} | "TERMINAL_AND_HETERO" | If "carbonLabelVisible" value is true, "HETERO" and "TERMINAL_AND_HETERO" values will be considered as "ALL". |
| "backgroundColor" | String | css color | - | custom non-transparent color |
{
"carbonLabelVisible" : false,
"atomIndicesVisible" : false,
"atomMapsVisible" : true,
"chiralFlagVisible" : true,
"valenceErrorVisible" : true,
"lonePairsVisible" : false,
"cpkColoring" : true,
"implicitHydrogen" : "TERMINAL_AND_HETERO",
"displayMode" : "WIREFRAME",
"backgroundColor" : "#ffffff"
}
Parameters:
jso - map of display setting is wrapped into a JavaScript object.
| Key | Type | Values | Default value | Notes |
|---|---|---|---|---|
| "carbonLabelVisible" | Boolean | {true, false} | false | does not apply in "BALLSTICK" displaymode |
| "chiralFlagVisible" | Boolean | {true, false} | true | - |
| "atomIndicesVisible" | Boolean | {true, false} | false | - |
| "atomMapsVisible" | Boolean | {true, false} | true | - |
| "cpkColoring" | Boolean | {true, false} | true | - |
| "valenceErrorVisible" | Boolean | {true, false} | true | - |
| "lonePairsVisible" | Boolean | {true, false} | false | - |
| "displayMode" | String | {"WIREFRAME", "BALLSTICK", "STICK", "SPACEFILL"} | "WIREFRAME" | - |
| "implicitHydrogen" | String | {"ALL", "OFF", "HETERO", "TERMINAL_AND_HETERO"} | "TERMINAL_AND_HETERO" | If "carbonLabelVisible" value is true, "HETERO" and "TERMINAL_AND_HETERO" values will be considered as "ALL". |
| "backgroundColor" | String | css color | - | - |
| "defaultTool" | String | {"rectangleSelection", "lassoSelection"} | "rectangleSelection" | set default tool |
| "toolbars" | String | {"standard", "education", "reaction", "markush", "search", "reporting"} | "standard" | to render toolbars by the given predefined layout |
| "copyasmrv" | Boolean | {true, false} | false | To prefer MRV instead of MDL molfile format at copy |
{
"carbonLabelVisible" : false,
"atomIndicesVisible" : false,
"atomMapsVisible" : true,
"chiralFlagVisible" : true,
"valenceErrorVisible" : true,
"lonePairsVisible" : false,
"cpkColoring" : true,
"implicitHydrogen" : "TERMINAL_AND_HETERO",
"displayMode" : "WIREFRAME",
"backgroundColor" : "#ffffff",
"defaultTool" : "lassoSelection",
"toolbars": "standard"
}
Returns: True if nothing on the canvas, else false.
Parameters:
format - the input format getSupportedFormats() or null to recognize the format automatically.source - the molecule sourceReturns: the Promise object
Returns: the JavaScript object.
webservices.js for the list of supported services.Parameters:
jso - map of services wrapped into a JavaScript object
{
"clean2dws" : <url of Clean2D webservice>
"molconvertws" : <url of MolConvert webservice>
"stereoinfows" : <url of CIP Stereo Info webservice>
"reactionconvertws" : <url of Reaction converter webservice>
"hydrogenizews" : <url of hydrogenize webservice>
"automapperws" : <url of auto mapper webservice>
}
Parameters:
jso - attributes of button is wrapped into a JavaScript object. E.g.:
{
"name": "customButton", // JS String
"image-url": "images/custom-button.png" // JS String
"toolbar": "W" // JS String: "W" as West, "E" as East, "N" as North, "S" as South toolbar
}
Parameters:
jso - a JavaScript object that describes the template. It has to contains the following properties:
| Name | Type | Description |
|---|---|---|
| structure | String | MRV source of the template structure |
| name | String | title of the template button (optional, auto generated) |
| icon | String | 24x24 pixel size icon for the button as base64 encoded data image (optional, auto generated) |
{
"structure": "<cml><MDocument><MChemicalStruct><molecule molID=\"m1\"><atomArray><atom id=\"a1\" elementType=\"C\" x2=\"-12.5625\" y2=\"6.539048685882614\"/><atom id=\"a2\" elementType=\"C\" x2=\"-13.808366329017026\" y2=\"5.633832087370612\"/><atom id=\"a3\" elementType=\"C\" x2=\"-13.332503911629807\" y2=\"4.169284647450719\"/><atom id=\"a4\" elementType=\"C\" x2=\"-11.792496088370193\" y2=\"4.169284647450719\"/><atom id=\"a5\" elementType=\"C\" x2=\"-11.316633670982972\" y2=\"5.633832087370612\"/></atomArray><bondArray><bond atomRefs2=\"a1 a2\" order=\"1\"/><bond atomRefs2=\"a1 a5\" order=\"1\"/><bond atomRefs2=\"a2 a3\" order=\"1\"/><bond atomRefs2=\"a3 a4\" order=\"1\"/><bond atomRefs2=\"a4 a5\" order=\"1\"/></bondArray></molecule></MChemicalStruct></MDocument></cml>",
"name": "CycloPentane",
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABBElEQVRIie3UK08DQRiF4UdW1q4CfgISW7kSRYIrihBEJQkKi0OiCKJQSVAEtRJD0CgkqYGAIhjEzCYFlr1Mi+ubfMlezpyZPd/ssGTBHOPwP4z7uME9HnCNbFHmG3jCSbzv4TQ+G8xrfoBX5BXvcjziKMV4DQXu4nWT7rZB940tTDFqqe9F7RTbTeJLIdv1tquZYRDHXtSt5B0rCeYlq3iLXpWcYW+OCXajx5/kQtNSKTRs3Z7QrH6CeYZnNfGUTKTF1BhPyaZwLHSlUP1D/iIlpgwfWsRTMsFOhwmGuOqg7xxTIfSgNX28YF/4kp81nKkRPiXsvHOMhZ1RV2M1x8OSRr4A1pQ2FuhcylgAAAAASUVORK5CYII="
}Returns: JavaScript object with indices of selected atoms and bonds. E.g.:
{
"atoms" : "1,2,3",
"bonds" : "1-2,2-3"
}
Parameters:
selection - JavaScript object that describes atoms and bonds to select. E.g.:
{
"atoms" : "1,2,3",
"bonds" : "1-2,2-3"
}
Parameters:
type - the event type ("molchange" or "selectionchange")callback - this function is performed after the specified event is invoked.Parameters:
type - the event type (accept same types as on(String,function()))callback - the reference of a previously attached event handler function to remove or null
to remove all event handlers for the specified event.Parameters:
format - the output molecule format getSupportedFormats().options - an object that describes further options for export (not used yet).Returns: the Promise object
Parameters:
format - the input format getSupportedFormats() or null to recognize the format automatically.source - the molecule sourceReturns: the Promise object