Draw is a simple canvas drawing utility for JavaScript. Its built on top of fabric-js.
This assumes you are using npm as your package manager.
To install the dependencies:
npm install
To start the tool:
npm start
To build a production copy of the library use the command
npm run build
It will generate the draw.css
and draw.js
required and will also generate a sample index.html
and app.css
listing all the necessary dependencies.
The entire draw
library is inspired by Redux.
- The tools are listed in each file in the draw/tools folder where they define, the structure of the Tool, the drawing function and the default properties.
- Then in the draw/tools/index.ts a massive switch case is written which determines the right tool based on what tool as selected on the UI.
- The drawing state/drawing loop is maintained in the DrawStateService which is located in draw/reducers/index.ts.
- When a user performs any action, the state is maintained and if its a tool based action, the toolservice is invoked to determine the right action to be performed.
There are some limitations of the code and currently SVG imports arent working. All other bugs are documented within the code and features can be extended/added accordingly.
This project is licensed under the MIT License - see the License file for details.