views:

206

answers:

1

I am currently experimenting with canvas drawing function in a uiwebview.Its a simple app that allows you to finger paint on the Iphone.Can someone point me in the rite direction on a problem I'm having.I need to be able to offset the touch so you can see what your painting instead of your finger being in the way.Its built on Html,javascript and css.Any ideas would be greatly appreciated.

A: 

On Touch Event Get The X and Y coordinates.... of the Touched place

Remove Some Pixels (Let's say 10) from Y Coordinate (Y-10) change the color of that Particular Place.... or something else to show drawing...

mihirpmehta
Got it thanks very much////////////////////////////////////////////////////////////////////function onCanvasTouchMove(a) { if (a.touches.length == 1) { var b = a.touches[0]; var x = b.offsetX + (b.clientX - b.x); var y = b.offsetY + (b.clientY - b.y); var x = (b.pageX - pageX(b.target)); var y = (b.pageY - pageY(b.target)); brush_shop.brushObj().stroke(x, y-30); style.stroke(x, y) }}
How2iphone