new Composer(parentOrElementOrDocument, editor)
A editor with essential UI for end users.
Parameters:
Name | Type | Description |
---|---|---|
parentOrElementOrDocument |
Variant | |
editor |
Kekule.Editor.BaseEditor | An editor instance embedded in UI. |
Properties:
Name | Type | Description |
---|---|---|
editor |
Kekule.Editor.BaseEditor | The editor instance embedded in UI. |
commonToolButtons |
Array | buttons in common tool bar. This is a array of predefined strings, e.g.: ['zoomIn', 'zoomOut', 'resetZoom', 'molDisplayType', ...].
If not set, default buttons will be used.
In the array, complex hash can also be used to add custom buttons, e.g.: [ 'zoomIn', 'zoomOut', {'name': 'myCustomButton1', 'widgetClass': 'Kekule.Widget.Button', 'action': actionClass}, {'name': 'myCustomButton2', 'htmlClass': 'MyClass' 'caption': 'My Button', 'hint': 'My Hint', '#execute': function(){ ... }}, ] |
chemToolButtons |
Array | buttons in chem tool bar. This is a array of predefined strings, e.g.: ['zoomIn', 'zoomOut', 'resetZoom', 'molDisplayType', ...].
If not set, default buttons will be used.
Chem tool often has a series of child tool buttons, you can also control to display which child buttons, e.g.:
[
{'name': 'bond', 'attached': ['bondSingle', 'bondDouble']}, 'atom', 'formula', ] Note: currently same child button can not be existed in different chem tool buttons. In the array, complex hash can also be used to add custom buttons, e.g.: [ 'atom', 'formula', {'name': 'myCustomButton1', 'widgetClass': 'Kekule.Widget.Button', 'action': actionClass}, {'name': 'myCustomButton2', 'htmlClass': 'MyClass' 'caption': 'My Button', 'hint': 'My Hint', '#execute': function(){ ... }}, ] |
styleToolComponentNames |
Array | Array of component names that shows in style tool bar. |
enableStyleToolbar |
Bool | |
enableObjModifierToolbar |
Bool | |
allowedObjModifierCategories |
Array | |
showInspector |
Bool | Whether show advanced object inspector and structure view. |
autoSetMinDimension |
Bool | |
editorConfigs |
Kekule.Editor.BaseEditorConfigs | Configuration of this editor. |
enableOperHistory |
Bool | Whether undo/redo is enabled. |
operHistory |
Kekule.OperationHistory | History of operations. Used to enable undo/redo function. |
renderType |
Int | Display in 2D or 3D. Value from Kekule.Render.RendererType. |
chemObj |
Kekule.ChemObject | The root object in editor. |
enableOperContext |
Bool | If this property is set to true, object being modified will be drawn in a separate context to accelerate the interface refreshing. |
objContext |
Object | Context to draw basic chem objects. Can be 2D or 3D context. Alias of property drawContext |
operContext |
Object | Context to draw objects being operated. Can be 2D or 3D context. |
uiContext |
Object | Context to draw UI marks. Usually this is a 2D context. |
objDrawBridge |
Object | Bridge to draw chem objects. Alias of property drawBridge. |
uiDrawBridge |
Object | Bridge to draw UI markers. |
selection |
Array | An array of selected basic object. |
enableLoadNewFile |
Bool | Whether open a external file to displayer is allowed. |
enableCreateNewDoc |
Bool | Whether create new object in editor is allowed. |
allowCreateNewChild |
Bool | Whether new direct child of space can be created. Note: if the space is empty, one new child will always be allowed to create. |
Extends
- Kekule.ChemWidget.AbstractWidget
Classes
Methods
-
(static) getMinPreferredDimension()
-
A class method to returns the preferred min dimension of composer widget.
-
canRedo() → {Bool}
-
Check if an undo action can be taken.
Returns:
- Type
- Bool
-
canUndo() → {Bool}
-
Check if an undo action can be taken.
Returns:
- Type
- Bool
-
exportObj(objClass) → {Object}
-
Returns exportable object for specified class.
Parameters:
Name Type Description objClass
Class Set null to export default object. Returns:
- Type
- Object
-
exportObjs(objClass) → {Array}
-
Returns all exportable objects for specified class. Descendants can override this method.
Parameters:
Name Type Description objClass
Class Set null to export default object. Returns:
- Type
- Array
-
getCoordMode() → {Int}
-
Returns coord mode of editor.
Returns:
- Type
- Int
-
getExportableClasses() → {Array}
-
Returns array of classes that can be exported (saved) from composer.
Returns:
- Type
- Array
-
hideAssocToolbar()
-
Hide assoc chem tool bar.
-
hideObjModifierToolbar()
-
Hide obj modifier tool bar.
-
hideStyleToolbar()
-
Hide style tool bar.
-
isAssocToolbarShown() → {Bool}
-
Check if assoc chem tool bar is visible.
Returns:
- Type
- Bool
-
isDirty() → {Bool}
-
Returns whether the chem object inside editor has been modified since load.
Returns:
- Type
- Bool
-
isObjModifierToolbarShown() → {Bool}
-
Check if obj modifier tool bar is visible.
Returns:
- Type
- Bool
-
isStyleToolbarShown() → {Bool}
-
Check if style tool bar is visible.
Returns:
- Type
- Bool
-
load(chemObj)
-
Load chem object in composer.
Parameters:
Name Type Description chemObj
Kekule.ChemObject -
newDoc()
-
Create a new object and load it in editor.
-
redo()
-
Redo last operation.
-
repaint()
-
Repaint the objects in editor.
-
showAssocToolbar()
-
Show assoc chem tool bar.
-
showObjModifierToolbar()
-
Show obj modifier tool bar.
-
showStyleToolbar()
-
Show style tool bar.
-
undo()
-
Undo last operation.
-
undoAll()
-
Undo all operations.