Adding gesture controls to your Windows Phone map code

Published by at

Released as a proof of concept, Colin Eberhardt has some code that might be useful to Windows Phone developers. Having spotted the vector based nature of the new maps in WP8, he wanted to add in two new gesture controls - two finger rotation and three finger pitching. And in the best nature of developers, he's posted the code on how to do it.

From the blog post:

The WP8 supports the same gestures that the Bing WP7 map did, i.e. a single-fingered pan gesture and two-fingered pinch to zoom. What about rotation and pitch? Why not allow the user to modify these via gestures? The key here is to add some new gestures that complement the existing one. I opted for the following:

  • Two-finger rotate – When the user places two fingers on the map this is currently used to zoom the display via a ‘spreading’ motion. However, if the user instead rotates the two touch points around the centre, the map should be rotated.
  • Three-finger pitch – When the user places three fingers on the map, if they drag up or down, the map should adjust its pitch accordingly.

Here it is in action:

This is what I like to see in my platform, hackers attacking the code in a good way, magnifying what is there, and making it useful. What I also like to see is the hacked changes getting adopted into the base code. Let's see what happens with that one.

You can read the full blog post with code samples here.

Source / Credit: Colin Eberhardt (Scott Logic)