OpenLayers and Touch Events

Here are a couple of approaches to dealing with touchevent as created on apple mobile devices.
  1. Mouse Emulation for Touch Events: Basically, it intercepts touchevents and turns them into mouse events. The debug box prints out some of the information available in the touchevents.

    Note that it allows for the use of common control elements (though the controls need to be supersized to use easily outside the simulator on real devices).

    Credits: This technique is straight from Ross Boucher. Special thanks to him for providing the code sample and explanations.

  2. Direct event calls to pan and zoom: Traditional direct event handling approach. More work, but more control, less sideeffects.

    Credits: Based on event handling code provided by FAN Baiquan and the whatamap team
  3. An integrative approach: Based on suggestions by Tim Schaub, this tries to work closely with the paradigm of touch and the structures of OpenLayers.

Browse the code

touch.js

IOL.js