Tap-to-Pan: Map Navigation on Browsers Without Touch
For the past two days, I’ve been surrounded by 5-6 devices at all times, trying to figure out what to do about the *rest* of the browsers out there who might want to use OpenLayers.
After a lot of grimacing, grumbling, and fighting with these devices, I’ve come up with a couple of demos of the functionality I’ve been working towards: Tap-to-Pan, recentering map on a tap event. The biggest problem that I faced was trying to determine when a tap was a tap, rather than a click. Mobile browsers have tried hard to support ‘legacy events’ — mousedown, up, etc. when using their various touch or tap functionalities. (In fact, this very approach is what allows for Map Navigation on the Kindle.) However, as a result it can be difficult to determine the difference between a desktop client, where a single click should not center the map, and a mobile browser without touch support.
After much gnashing of teeth, I’ve got a solution that seems to work for:
- Firefox (built-in) on Maemo (N900)
- Firefox4 Beta on N900
- IE on WP7
- Opera Mobile on Symbian touch devices
You can see it in action on YouTube:
Tap-to-Pan on Nokia E7 (Opera)
Tap-to-Pan on IE7 on WP7
(Still to be done: Symbian’s built in browser on the E7. Unfortunately, mouse events are handled just differently enough that it’s very difficult to establish the difference between that browser and a desktop.)
It’s not ideal navigation, but as you can see, it allows one to move around the map on these devices, something that would be very difficult without any other sort of dragging support.
If you’d like to test it yourself, you can go to the tap-to-pan test page and try it out. Note that the code currently has an alert() in it to tell you whether it detects you’re on a tap browser or not; this alert happens in response to your first ‘click’ on the map. If you find that this is returning ‘false’ on an OS/platform/browser that you expect to be returning true, feel free to drop by #openlayers on irc.freenode.net, or send an email to the mailing lists with information on your platform so I can look into whether supporting it is practical. 🙂
July 10th, 2011 at 4:56 am
I used something similar on HTC without touch screen recently and the experience was quite bad. I guess they might be phasing out such models.
March 6th, 2012 at 2:54 am
I have Nokia E7 and I was thinking 2 sell this crap phone. But symbian sucks.