// before:
setTimeout( function() { runTimer(); } , 1000/30 );
function runTimer() {
// update graphics here
setTimeout( function() { runTimer(); } , 1000/30 );
}
// after:
setInterval( function(){ runTimer(); }, 1000/30 );
function runTimer() {
// update graphics here
}
I initially thought that my touch events (touchstart, touchmove, touchend) were randomly failing after zooming, because my custom motion code would completely break after running at a solid 30+ fps. It appears that this is a known bug in pre-2.2 (Froyo) Android web browsers: http://code.google.com/p/android/issues/detail?id=8566
A collection of handy code snippets in the languages that I use on a daily basis.
July 27, 2010
Android browser bug: pinch/zoom kills setTimeout()
I'm working on some cross-platform/mobile touch/mouse code for a fancy html/js UI, and everything's been working great, but when I pinch/zoom the web page in an Android browser, my setTimeout() calls stop running. To be safe, I recommend using setInterval() instead.
Labels:
Android,
bug,
html,
javascript,
mobile,
pinch,
setinterval,
settimeout,
zoom
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment