angular-draw-chem v2.0.0-beta
latest stable release: v1.0.0
current:
aim of the project
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.
examples
Visit AngularDrawChem page!
possible usage
- By adding
mmAngularDrawChemmodule 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
svgand place it within yourhtml. - Download:
- Github
- npm
npm i angular-draw-chem - bower
bower install angular-draw-chem
features
The following features have been already implemented:
✔ 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.
Still to do:
− 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.
components
The project consists of the following components:
editor directive
drawChemEditordirective- the directive for interaction between the user and the editor,DrawChemDirectiveMouseActionsfactory- helper service with all mouse actions fordrawChemEditordirective,DrawChemDirectiveUtilsfactory- helper service with some utility functions fordrawChemEditordirective,DrawChemDirectiveFlagsfactory- helper service containing info about currently selected tools; keeps track of mouse-related stuff.
svg rendering services
DrawChemfactory- the main entry point for the use in a customcontroller,DrawChemSvgUtilsfactory- utilities for constructingsvgelements,DrawChemSvgBondsfactory- utilities for making bonds insvg,DrawChemSvgRendererfactory- contains key functionalities for transforming aStructureobject intosvg.
structure modify services
DrawChemModStructure- contains utilities for modifying aStructureobject (adding new bonds, etc.)
helper services
DrawChemConstantsfactory- contains constant values, such as bond length, bond width, etc.,DrawChemCachefactory- caching service forStructureobjects,DrawChemUtilsfactory- various utilities, e.g. for vectors (addition, subtraction, etc.).
keyboard shortcuts
dcShortcutsdirective- the directive bindingkeydownandkeyupevent listeners,DCShortcutsStoragefactory- service that enables registering of new keyboard shortcuts; it also keeps track of keys pushed and released, in order to fire a suitable event.
paths provider
DrawChemPathsprovider- enables to configure paths to some static resources related to the editor (templateUrlfordrawChemEditordirective, svgs used in the UI).
menu items
DrawChemActionsfactory- contains all actions available underActionsmenu,DrawChemEditsfactory- contains all actions available underEditmenu,DrawChemArrowsfactory- contains all arrows available underArrowsmenu,DrawChemGeomShapesfactory- contains all geometrical shapes available underShapesmenu,DrawChemStructuresfactory- defines basic structures, such as single bond, basic molecules (benzene, cyclohexane, etc.), available underStructuresmenu,DrawChemLabelsfactory- defines basic labels, such as oxygen, sulfur, etc., available underLabelsmenu.
classes
DCSvgfactory- definesSvgclass, which encapsulates svg-relevant data,DCAtomfactory- definesAtomclass, which encapsulates data about a single atom,DCBondfactory- definesBondclass, which encapsulates data about a single bond,DCStructurefactory- definesStructureclass, which encapsulates data about thw hole structure and some tools (selection, alignment),DCStructureClusterfactory- definesStructureClusterclass, which enables grouping of multipleStructureobjects; used for predefined structures,DCLabelfactory- definesLabelclass, which encapsulates data about a label,DCArrowfactory- definesArrowclass, which encapsulates data about an arrow,DCArrowClusterfactory- definesArrowClusterclass, which enables grouping of multipleArrowobjects,DCCyclicStructure- definesCyclicStructurewhich encapsulates data about cyclic structures,DCBondStructure- definesBondStructurewhich encapsulates data about non-cyclic structures (only bonds for now).
license
MIT
10 years ago
10 years ago