Stop screen drag when drawing on a canvas
I'm trying to do a signature capture on a HTML5 canvas. When I try to use a stylus to write on the canvas all it does is drag the screen around. Is there a way to disable the screen drag for certain elements or for the whole web page? I've tried the Meta "viewport" setting to size the device width and height and also played with the @media "visual" in the CSS but also with no success.
Thanks in advance. Terry
All Replies (4)
It's not possible to do this in the current version of Firefox for Android, but you will be able to do it soon using touch events. As long as the Firefox toolbars are off-screen, you can call "event.preventDefault()" on the "touchstart" event to stop the page from scrolling. For more documentation, see:
http://www.w3.org/TR/touch-events/
https://wiki.mozilla.org/Fennec/Features/touch
Touch events are already supported by Safari and by the default Android Browser. They will be also be supported in Firefox 6 for Android, which will be released in August 2011. You can start testing Firefox 6 with touch event support today by downloading an Aurora build:
https://wiki.mozilla.org/Mobile/Platforms/Android#Download_Aurora
(Note: the touch event standard is still in development, and not all browsers support all parts of the specification.)
Thanks for the reply. I'll implement the "touchstart" and see what happens on the default Android browser. As a bit of a side issue do you know if Firebug is going to available for the Android & mobile versions?
Thanks Terry.
I don't know of anyone porting Firebug to mobile Firefox, but you can get a basic JavaScript/error console by turning on "devtools.errorconsole.enabled" in about:config and then tapping on the "bug" tab in the preferences panel. There are also some useful add-ons for developers here:
https://addons.mozilla.org/en-US/mobile/collections/matt-brubeck/ada1e4d0-346d-c654-94ac-f6777b/
Thanks for the info. Could get the signature to work on the default Android either as it doesn't appear to support the html5 canvas.
Regards Terry.