Giter Club home page Giter Club logo

drawing-tool's Introduction

HTML5 Drawing Tool

Demo: http://concord-consortium.github.io/drawing-tool/examples/

External dependencies

  • jQuery
  • FabricJS

Development

  • Install (if you don't have them):
  • Run:
    • yarn to install dependencies.
    • webpack --watch -- Automatically compiles sources to ./dist
    • live-server . -- starts a web server on http://localhost:8080/
    • Open http://localhost:8080/examples/.
    • Code!
    • Before you commit, run webpack to update dist directory and add it to git index.

Deploying to Github Pages

Use push-gh-pages.sh script. It (re)generates dist dir using webpack, updates gh-pages branch and pushes changes to Github.

Note that you may deploy uncommitted changes, as this script uses current working directory state.

Undo / redo feature

If you are planning to add new feature that will be exposed in UI or via main API, you should consider whether this action should be saved in history (so undo and redo is possible) or not.

If so, all you need to do is to call DrawingTool.pushToHistory method.

The current convention is that everything that modifies canvas should be saved in history, e.g.:

  • new object created
  • object removed
  • object stroke color changed
  • canvas dimensions changed

However state of the drawing tool itself is not tracked, so e.g. following events are not saved:

  • tool changed
  • current stroke color changed
  • current fill color changed

If an action is async and callback can be provided, callback should be invoked after history is updated (see DrawingTool.setBackgroundImage). It gives us more flexibility, as the client code can reset history after action is complete so user won't be able to undo it (sometimes it is useful).

JSON state converter

Drawing Tool state can be serialized to JSON. If you're introducing non-backward compatible change, update version in DrawingTool#save method and add approperiate conversion to convert-state.js.

drawing-tool's People

Contributors

pjanik avatar bunsenmcdubbs avatar knowuh avatar psndcsrv avatar ddamelin avatar

Stargazers

 avatar webdev778 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.