new ChemObjInserter()
A chem widget to insert chem viewer elements to HTML document.
This widget is mainly designed for extra web editor plugins or browser addons.
Properties:
Name | Type | Description |
---|---|---|
viewer |
Kekule.ChemWidget.Viewer | The viewer instance embedded in this widget. |
renderType |
Int | Display in 2D or 3D. Value from Kekule.Render.RendererType. |
chemObj |
Kekule.ChemObject | The root object in editor. |
showInfo |
Bool | Whether info label is shown. |
Extends
- Kekule.ChemWidget.AbstractWidget
Classes
Methods
-
createExportImgElement(doc, dataType, options) → {HTMLElement}
-
Export viewer to a new created HTML img element.
Parameters:
Name Type Description doc
HTMLElement dataType
String Export image data type options
Hash Returns:
- Type
- HTMLElement
-
exportDetails(dataType, options) → {Hash}
-
Export drawing content in viewer and with additional informations (such as draw options).
Parameters:
Name Type Description dataType
String options
Hash Returns:
- Type
- Hash
-
exportToDataUri(dataType, options) → {String}
-
Export drawing content in viewer to a data URL for tag to use.
Parameters:
Name Type Description dataType
String Type of image data, e.g. 'image/png'. options
Hash Export options, usually this is a number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp. Returns:
- Type
- String
-
getContextDimension() → {Hash}
-
Returns dimension of viewer context.
Returns:
- Type
- Hash
-
getExportImgElemAttributes(dataType, options) → {Hash}
-
If export viewer to a HTML img element, this method returns the essential attributes.
Parameters:
Name Type Description dataType
String Export image data type. options
Hash Returns:
Attribute/value pairs.- Type
- Hash
-
importChemObjWithDetails(chemObj, detail)
-
Load a chem object and apply settings in this widget from specified attribs.
Parameters:
Name Type Description chemObj
Kekule.ChemObject detail
Hash -
importFromElem(element)
-
Load a chem object and apply settings in this widget from an HTML element previously exported.
Parameters:
Name Type Description element
HTMLElement -
importFromElemAttribs(attribs)
-
Load a chem object and apply settings in this widget from hash attribs of an HTML element prviously exported.
Parameters:
Name Type Description attribs
Hash -
initialize()
-
setContextDimension(dimension)
-
Resize self to make viewer context at dimension.
Parameters:
Name Type Description dimension
Hash