I have a canvas where you can draw and I would like the user to see the size of the point he is drawing. So I need to draw a custom cursor as 10x10 pixel square on the canvas. Of course I would not like to paint over the image while the user is just moving the mouse.
My ideas how I could do this:
- I could somehow backup the original image and paint it all over every time
- I could move a with the cursor. But I would need to forward every click and make it invisible if the cursor left the canvas.
- I could create a layered canvas with a second canvas on top of mine just for drawing the cursor.
What would be the best to do this?
Update
Sorry, I did not explain myself very well. The cursor will need to change color and snap to a grid, so I really need to paint it myself. I know about css cursor:url(...)
that does not work for me.