views:

52

answers:

2

I'm trying to make a canvas where the client can sign his name. It works well in Chrome v6: alt text

but on Android 1.5 instead of drawing the browser scrolls the page and draws nothing: alt text

I borrows the code from Opera's website. Can I disable the scrolling or how can I make this work?

Thank you!

EDIT

using the events touchstart, touchmove and touchend:

on a LG GW620R using a stylus: alt text

on a Motorola Milestone: alt text

on a Samsung Galaxy: alt text

EDIT 2 works better whitout using the finger nail

+2  A: 

You're comparing the bleeding-edge in-development Chrome version to a stable 1.5 year old release of a parallel Webkit-based browser... of course there's better support for new HTML5 features in the much-newer experimental browser :) How does it render in a recent Android release (say, 2.2)? How about iOS?

There are definitely nontrivial differences between HTML5 browser support among Android releases (not to mention non-standard browser releases by HTC in SenseUI and the like). Check out the WebKit comparison chart at Quirksmode.

As far as viewport settings and disabling scrolling, Android's Webkit listens to most of the same settings that iPhone Safari does, and Apple has pretty good documentation on the settings you can use to tweak that.

You also may find this quirksmode post about supported events in mobile Safari helpful.

Yoni Samlan
I know Android 1.5 is old, but it's the os version we currently use in production. It does the same on Android 2.1. I'll look at the links you posted, bbl.
Sirber
+2  A: 

@Sirber There might be touchstart and touchend events just like in mobile Safari, have a look at that avenue too. And maybe if you adjust the viewport meta tag there won't be any scrolling, still won't draw but at least it won't scroll.

Good luck,

Mathieu

mathieuc
I modded the sample code with `this.touchstart = function (ev) { tool.mousedown(ev); }`, `this.touchmove = function (ev) { tool.mousemove(ev); }` and `this.touchend = function (ev) { tool.mouseup(ev); }`, and it's slow but it works!
Sirber
http://mobilegeo.wordpress.com/2010/01/05/testing-open-layers-with-iphone-and-android/
Sirber
Great! As far as optimisation goes, you could try to ignore a few touchmove events as I believe they must be fired quite a lot for nothing and hog your script. Something like 1 in 3 should do it.
mathieuc
Thank you! :D __
Sirber
instead of displaying it realtime, we could store the XY in an array and display it in the `touchend`. CPU seems ti have difficulties to keep up
Sirber