Search code examples
javascriptdrawing

JavaScript Drawing API Selection


I'm going to be writing my own lightweight formula editor (for inputting mathematical expressions) in JavaScript, and was wondering what APIs the StackOverflow community would choose to use. I found a rather interesting JS drawing library called Raphael that looks like it could do everything I need it to, but figured it couldn't hurt to put in a request for commentary here first.

Some basic requirements:

  • Need to be able to draw text and/or shapes of any color/size at any coordinate I desire
  • Need the ability to register shapes/areas to listen to events such as keyboard or mouse input, and to write custom event handlers accordingly
  • Must be able to make calls to some of my AJAX components

Just looking to use the right tool for the job here! Thanks!


Solution

  • Raphael will fit all of the requirements you've listed. You can draw anything you like and attach event handlers to them (I've used it in conjunction with jQuery). The best part is that it works great in all browsers I've tested.