mobomo / sketch.js

A jQuery plugin for dead simple Canvas-based drawing.
http://intridea.github.com/sketch.js
290 stars 110 forks source link

Eventing added to sketch.js #44

Closed rdbhost closed 3 months ago

rdbhost commented 8 years ago

I have enjoyed using your thoughtfully designed library, sketch.js, for a shared whiteboard 'toy' app. In the process of integrating sketch into my app, I found it necessary to add some eventing. Perhaps other users of the library would benefit from these enhancements.

I added three event emits, to announce the beginning, end, and extension of each action. Each event carries, as extra data, the action data. I also added two event listeners, one 'clear', to clear the Sketch object and canvas, and 'load', to add a set of actions to the Sketch object and canvas.

The sketch.coffee file has been modified with the changes, and sketch.js compiled with the online compiler at coffeescript.org. I also added a paragraph to the 'index.html' documentation file, but did not preview it.

I do not have front-end tooling setup to compile and minify the coffeescript, so only updated the coffee file and the un-minified JavaScript. When you merge, you might want to download merged source and run your front-end tooling scripts to finish up.

Anyway, thank you for your work.

David