latest stable release: v2.0.0-beta
current:
The aim of this project is to create a light-weight, AngularJS-based editor for producing structural formulas (organic molecules mainly).
The editor is from the beginning designed to support svg
, thus enabling drawing of good-looking, scalable structures.
Visit AngularDrawChem page!
- By adding
mmAngularDrawChem
module to your project, making it available for the users of your website, so they can interact with it and make their own structures. - You can use it on the project website, make structures that you need, grab the
svg
and place it within yourhtml
. - Download:
- Github
- npm
npm i angular-draw-chem
- bower
bower install angular-draw-chem
✔ open/close editor,
✔ transfer svg,
✔ clear canvas,
✔ go one structure forward/back,
✔ copy/cut/paste selected structures,
✔ select/deselect all structures,
✔ move selected structure with arrows/mouse,
✔ align selected structures up/down/left/right,
✔ delete selected structures,
✔ erase single atom/bond,
✔ basic reaction arrows,
✔ cyclic structures (from three- to nine-membered rings),
✔ bonds (single, double, triple, dash, wedge, undefined),
✔ predefined labels,
✔ removing labels,
✔ custom labels.
− make different cache 'instances',
− add 'align middle' tools (vertical and horizontal),
− enable adding text elements (e.g. for comments or adding reaction conditions over an arrow),
− add possibility to select single atoms/bonds,
− add possibility to make fused rings,
− add possibility to make simple calculations (mass weight, formula, etc.),
− add more scenario tests,
− add user manual.
The project consists of the following components:
drawChemEditor
directive
- the directive for interaction between the user and the editor,DrawChemDirectiveMouseActions
factory
- helper service with all mouse actions fordrawChemEditor
directive,DrawChemDirectiveUtils
factory
- helper service with some utility functions fordrawChemEditor
directive,DrawChemDirectiveFlags
factory
- helper service containing info about currently selected tools; keeps track of mouse-related stuff.
DrawChem
factory
- the main entry point for the use in a customcontroller
,DrawChemSvgUtils
factory
- utilities for constructingsvg
elements,DrawChemSvgBonds
factory
- utilities for making bonds insvg
,DrawChemSvgRenderer
factory
- contains key functionalities for transforming aStructure
object intosvg
.
DrawChemModStructure
- contains utilities for modifying aStructure
object (adding new bonds, etc.)
DrawChemConstants
factory
- contains constant values, such as bond length, bond width, etc.,DrawChemCache
factory
- caching service forStructure
objects,DrawChemUtils
factory
- various utilities, e.g. for vectors (addition, subtraction, etc.).
dcShortcuts
directive
- the directive bindingkeydown
andkeyup
event listeners,DCShortcutsStorage
factory
- service that enables registering of new keyboard shortcuts; it also keeps track of keys pushed and released, in order to fire a suitable event.
DrawChemPaths
provider
- enables to configure paths to some static resources related to the editor (templateUrl
fordrawChemEditor
directive, svgs used in the UI).
DrawChemActions
factory
- contains all actions available underActions
menu,DrawChemEdits
factory
- contains all actions available underEdit
menu,DrawChemArrows
factory
- contains all arrows available underArrows
menu,DrawChemGeomShapes
factory
- contains all geometrical shapes available underShapes
menu,DrawChemStructures
factory
- defines basic structures, such as single bond, basic molecules (benzene, cyclohexane, etc.), available underStructures
menu,DrawChemLabels
factory
- defines basic labels, such as oxygen, sulfur, etc., available underLabels
menu.
DCSvg
factory
- definesSvg
class, which encapsulates svg-relevant data,DCAtom
factory
- definesAtom
class, which encapsulates data about a single atom,DCBond
factory
- definesBond
class, which encapsulates data about a single bond,DCStructure
factory
- definesStructure
class, which encapsulates data about thw hole structure and some tools (selection, alignment),DCStructureCluster
factory
- definesStructureCluster
class, which enables grouping of multipleStructure
objects; used for predefined structures,DCLabel
factory
- definesLabel
class, which encapsulates data about a label,DCArrow
factory
- definesArrow
class, which encapsulates data about an arrow,DCArrowCluster
factory
- definesArrowCluster
class, which enables grouping of multipleArrow
objects,DCCyclicStructure
- definesCyclicStructure
which encapsulates data about cyclic structures,DCBondStructure
- definesBondStructure
which encapsulates data about non-cyclic structures (only bonds for now).
MIT