new ChemObjPainter3D(chemObj, drawBridge, options, renderConfigs)
Painter used by user to draw a chem object in 3D.
Parameters:
| Name | Type | Description |
|---|---|---|
chemObj |
Kekule.ChemObject | Object to be drawn. |
drawBridge |
Object | A object that implements the actual draw job. |
options |
Hash | Options to draw object. |
renderConfigs |
Object | Global configuration for rendering. This property should be an instance of Kekule.Render.Render2DConfigs or Kekule.Render.Render3DConfigs. Set this param to null to use default configs. |
- Source:
Extends
Methods
-
beginUpdatePainter()
-
Call this method before a series of rendered element updating job (for instance, call update method) to avoid unnecessary redraw.
- Inherited From:
- 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 contextObject newOptionsHash - Inherited From:
- Source:
-
clear(context) → {Bool}
-
Clear whole chemObj on context.
Parameters:
Name Type Description contextObject - Inherited From:
- Source:
Returns:
Whether the actual clear job is done.- Type
- Bool
-
clearContext(context)
-
Clear the painted objects in whole context.
Parameters:
Name Type Description contextObject - Inherited From:
- Source:
-
createContext(parentElem, width, height) → {Object}
-
Create an suitable context for drawing.
Parameters:
Name Type Description parentElemElement HTML element, context will be append to it. widthInt heightInt - Inherited From:
- 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 contextObject Context to be drawn, such as Canvas, SVG, VML and so on. baseCoordHash Coord of center to draw this object, can be null. This coord is based on context. optionsHash Draw options, such as draw rectangle, draw style, zoom and so on. Different coordMode may requires different option params. - Inherited From:
- Source:
-
endUpdatePainter()
-
Call this method after a series of rendered element updateing job, notify the painter to redraw the context.
- Inherited From:
- Source:
-
estimateObjBox(context, options, allowCoordBorrow) → {Hash}
-
Estimate the bound box around current chemObj (in chem coord system).
Parameters:
Name Type Description contextObject optionsObject allowCoordBorrowBool - Inherited From:
- 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 contextObject baseCoordHash Center coord in context to draw object. Can be null. optionsObject allowCoordBorrowBool - Inherited From:
- 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 contextObject baseCoordHash Center coord in context to draw object. Can be null. optionsObject allowCoordBorrowBool - Inherited From:
- 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 contextObject - Inherited From:
- Source:
-
supportGeometryOptionChange() → {Bool}
-
Check if changeGeometryOptions is availble to current renderer.
- Inherited From:
- Source:
Returns:
- Type
- Bool
-
update(context, updatedObjs, updateType)
-
Update a child object inside chemObj. Must be called after draw.
Parameters:
Name Type Description contextObject updatedObjsVariant Object or Array updateTypeInt Value from Kekule.Render.ObjectUpdateType - Inherited From:
- Source: