开发者

Paint on Canvas in Android's browser, page scroll?

开发者 https://www.devze.com 2023-01-12 20:51 出处:网络
I\'m trying to make a canvas where the 开发者_运维技巧client can sign his name. It works well in Chrome v6:

I'm trying to make a canvas where the 开发者_运维技巧client can sign his name. It works well in Chrome v6:

Paint on Canvas in Android's browser, page scroll?

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

Paint on Canvas in Android's browser, page scroll?

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:

Paint on Canvas in Android's browser, page scroll?

on a Motorola Milestone:

Paint on Canvas in Android's browser, page scroll?

on a Samsung Galaxy:

Paint on Canvas in Android's browser, page scroll?

EDIT 2 works better whitout using the finger nail


@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


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.


Canvas with iOS is really better (performances). Android browsers are far behind (doesn't work with opera-mini).

If you want to see the difference, just try with http://webdemo.visionobjects.com/ . I'm just doing a quadratic smoothing for an handwriting input method with the HTML5 canvas-element.

tested with iPad1 & Motorola Xoom

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号