Draw simple lines and shapes using Raphael, (Mootools as a support library based on this fiddle sample). The framework raphael.js is a great tool for vector graphics in the web, it is pretty much lightweight and supports the major browsers including mobile platforms. Thus drawing in the web is pretty much possible without using flash.
Below are the five items that describes the iplementation of this script.
- The key events in this example is the detection of mousemove, mouseup and mousedown.
- Identify the coordinates of the canvas.
- Identify the start point and the end point of the line.
- Until mousedown is not yet detected, update the line based on the coordinates detected on mousemove.
- When the mousedown is detected render the final line.