{"id":455,"date":"2011-02-26T07:07:11","date_gmt":"2011-02-26T12:07:11","guid":{"rendered":"http:\/\/crschmidt.net\/blog\/?p=455"},"modified":"2011-02-26T07:07:11","modified_gmt":"2011-02-26T12:07:11","slug":"who-needs-more-than-one-finger-android","status":"publish","type":"post","link":"https:\/\/crschmidt.net\/blog\/archives\/455\/who-needs-more-than-one-finger-android\/","title":{"rendered":"&#8220;Who needs more than one finger?&#8221; &#8212; Android"},"content":{"rendered":"<p>After Tim Schaub got pinch-zoom into trunk yesterday with some excellent work and debugging from him and Bruno Binet, I was excited to see people able to use OpenLayers for easy navigation of the map on browsers with touch events. Turns out, my excitement was misplaced: though the functionality is functional (and super-slick!) on iOS devices greater than v2.0, on the Android platform, it&#8217;s not.<\/p>\n<p>Turns out, the reason is simple: Android browsers don&#8217;t implement multitouch at the Javascript level.<\/p>\n<p>You can zoom an Android page by using two fingers to pinch, but those events are never delivered to the DOM as multiple touch events; instead, we simply get one touch, no matter how many fingers are interacting with the screen. <\/p>\n<p>Using the <a href=\"http:\/\/bit.ly\/eDZrIw\">Multitouch Test<\/a> OpenLayers example, I&#8217;ve gotten reports from far and wide, from 2.1 all the way up to 2.3 (Gingerbread): the Android browser only supports one touch event. For comparison? iOS supports up to 5. <\/p>\n<p>The OS supports these events: In fact, a multitouch-on-Android development article suggests <a href=\"http:\/\/www.zdnet.com\/blog\/burnette\/how-to-use-multi-touch-in-android-2-part-3-understanding-touch-events\/1775\">behavior very similar to the browser events<\/a>. (There is a slight difference; in the browser DOM, you don&#8217;t get different events for DOWN vs. POINTER_DOWN; they&#8217;re both a touchstart.) You have a series of move events, and each move has a list of touches attached to it &#8212; in iOS\/Safari, these equate to the evt.touches array of <a href=\"http:\/\/developer.apple.com\/library\/safari\/#documentation\/UserExperience\/Reference\/TouchClassReference\/Touch\/Touch.html%23\/\/apple_ref\/javascript\/cl\/Touch\">Touch<\/a> objects attached to the <a href=\"http:\/\/developer.apple.com\/library\/safari\/#documentation\/UserExperience\/Reference\/TouchEventClassReference\/TouchEvent\/TouchEvent.html%23\/\/apple_ref\/javascript\/cl\/TouchEvent\">TouchEvents<\/a>. <\/p>\n<p>This documentation has been around for almost 3 years &#8212; the functionality existed in iOS before the T-Mobile G1 device even shipped (in October of 2008). The touch events in Android for single touches map pretty much exactly to Apple&#8217;s spec, but no multitouch support exists at the DOM level, and no clearly documented plans to. <\/p>\n<p>I just hope that the plan on the Android side isn&#8217;t to wait until the <a href=\"http:\/\/www.w3.org\/2010\/webevents\/charter\/\">webevents W3C group<\/a> ships a Recommendation in 2012&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After Tim Schaub got pinch-zoom into trunk yesterday with some excellent work and debugging from him and Bruno Binet, I was excited to see people able to use OpenLayers for easy navigation of the map on browsers with touch events. Turns out, my excitement was misplaced: though the functionality is functional (and super-slick!) on iOS [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-455","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts\/455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/comments?post=455"}],"version-history":[{"count":0,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts\/455\/revisions"}],"wp:attachment":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/media?parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/categories?post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/tags?post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}