Eraser tool in html5 canvas -


hi building windows store app html5 , javascript in app trying implement eraser tool problematic because if user moves image or layer they've erased, see white drawing erased. have been trying eraser tool different ways example have changed default globalcompositeoperation "destination-out" code

          //here error.         if (clicktool[j] == "eraser") {             ctx.globalcompositeoperation = 'destination-out';             ctx.fillstyle = 'rgba(255,0,0,0.5);';             ctx.strokestyle = 'rgba(255,0,0,0.5);';          }         else {             ctx.globalcompositeoperation = "source-over";             ctx.strokestyle = clickcolor[j];         } 

but unfortunately doesn´t work me. have uploaded code link:

my code

please me.

thanks , i'm sorry speech , i'm mexican.

use multiple layers. have 1 canvas background image , drawing; why never erase of background image.

if need to, can have multiple layers don't impact performance.

and of course if can combine layers, last drawn squiggle background layer, if deem drawing "permanent".


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -