drawingboard.js
drawingboard.js copied to clipboard
eraser on background image doesn't work
The eraser does not work as expected when a background image is set. Even when the eraserColor is set to transparent, it erases the image with a color.
Well, this is kinda tricky but, I just tested, this case seems to work "normally" for me.
Here is the thing: everything is drawn only on one canvas as for now (there is no "background layer"). So the current, not ideal but "normal" behavior is that the eraser will always erase the background too.
When you set "transparent" as the eraserColor, it will show the color of your website's background. On http://leimi.github.io/drawingboard.js, it would show the gray background. Yeah, I could have called the "transparent" mode more like "destroyyyyyy".
As for now, the eraser won't erase anything if the eraserColor is set to "background" and the background is not a color.
Having some sort of second canvas layer that would be merge into the other one when needed (to export image as png for example) would be a better way to deal with the background.