-
beginUpdatePainter()
-
Call this method before a series of rendered element updating job (for instance, call update method)
to avoid unnecessary redraw.
- Source:
-
changeGeometryOptions(context, newOptions)
-
Repaint with only geometry options (translate/zoom/rotate) changes (without the modification of chemobj or draw color, molecule type...).
In 3D mode sometimes this repainting can be achieved by the modify of camera position (without recalc the position of node and connectors)
so that the speed may enhance greatly.
Parameters:
Name |
Type |
Description |
context |
Object
|
|
newOptions |
Hash
|
|
- Source:
-
clear(context) → {Bool}
-
Clear whole chemObj on context.
Parameters:
Name |
Type |
Description |
context |
Object
|
|
- Source:
Returns:
Whether the actual clear job is done.
-
Type
-
Bool
-
clearContext(context)
-
Clear the painted objects in whole context.
Parameters:
Name |
Type |
Description |
context |
Object
|
|
- Source:
-
createContext(parentElem, width, height) → {Object}
-
Create an suitable context for drawing.
Parameters:
Name |
Type |
Description |
parentElem |
Element
|
HTML element, context will be append to it. |
width |
Int
|
|
height |
Int
|
|
- Source:
Returns:
-
Type
-
Object
-
draw(context, baseCoord, options)
-
Draw an instance of ChemObject to context.
The actual job is done in doDraw method. Descendants should override doDraw.
Parameters:
Name |
Type |
Description |
context |
Object
|
Context to be drawn, such as Canvas, SVG, VML and so on. |
baseCoord |
Hash
|
Coord of center to draw this object, can be null. This coord is based on context. |
options |
Hash
|
Draw options, such as draw rectangle, draw style, zoom and so on.
Different coordMode may requires different option params. |
- Source:
-
endUpdatePainter()
-
Call this method after a series of rendered element updateing job,
notify the painter to redraw the context.
- Source:
-
estimateObjBox(context, options, allowCoordBorrow) → {Hash}
-
Estimate the bound box around current chemObj (in chem coord system).
Parameters:
Name |
Type |
Description |
context |
Object
|
|
options |
Object
|
|
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
A 2D or 3D box, in chemObj's coord system.
-
Type
-
Hash
-
estimateRenderBox(context, baseCoord, options, allowCoordBorrow) → {Hash}
-
Estimate the bound box need to render current chemObj (in context coord system).
Parameters:
Name |
Type |
Description |
context |
Object
|
|
baseCoord |
Hash
|
Center coord in context to draw object. Can be null. |
options |
Object
|
|
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
A 2D or 3D box, in context's coord system.
-
Type
-
Hash
-
estimateScreenBox(context, baseCoord, options, allowCoordBorrow) → {Hash}
-
Estimate the bound box need to render current chemObj (in screen coord system).
Parameters:
Name |
Type |
Description |
context |
Object
|
|
baseCoord |
Hash
|
Center coord in context to draw object. Can be null. |
options |
Object
|
|
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
A 2D or 3D box, in context's coord system.
-
Type
-
Hash
-
redraw(context)
-
Redraw previous object on context with same draw options. Should not be called before draw.
Parameters:
Name |
Type |
Description |
context |
Object
|
|
- Source:
-
supportGeometryOptionChange() → {Bool}
-
Check if changeGeometryOptions is availble to current renderer.
- Source:
Returns:
-
Type
-
Bool
-
update(context, updatedObjs, updateType)
-
Update a child object inside chemObj. Must be called after draw.
Parameters:
- Source: