- circle(e.clientX, e.clientY)
- } )
- canvas.addEventListener( 'mousemove', function(e) {
- if ( mouse == 1 ) { circle(e.clientX, e.clientY) }
- } )
+ image_serialize += " polyline"
+ image.beginPath()
+ draw(x, y)
+ }
+ function drawstop() {
+ mouse = 0
+ image.closePath()
+ dbg.innerHTML = image_serialize
+ data.value = image_serialize
+ }
+
+ window.addEventListener( 'mouseup', function() { drawstop() } )
+ canvas.addEventListener( 'mousedown', function(e) { drawstart(e.clientX, e.clientY) } )
+ canvas.addEventListener( 'mousemove', function(e) { draw(e.clientX, e.clientY) } )
+
+ window.addEventListener( 'touchend', function() { drawstop() } )
+ canvas.addEventListener( 'touchstart', function(e) { drawstart(e.touches[0].clientX, e.touches[0].clientY) } )
+ canvas.addEventListener( 'touchmove', function(e) { e.preventDefault(); draw(e.touches[0].clientX, e.touches[0].clientY) } )
+