1

Is it possible to handle simultaneous zoom and pan events using a MapView?

The Google Maps app for Android allows the map to be panned while a pinch-to-zoom gesture is already underway. This is helpful for making fine adjustments while you zoom in on a region of the map. The default MapView does not seem to support this.

I am prepared to implement this functionality myself, but I would prefer to use the built-in mechanisms.

acj
  • 4,821
  • 4
  • 34
  • 49

1 Answers1

0

I solved this problem using an Overlay. By overriding the overlay's onTouchEvent() and detecting when zoom and pan events happen, those events can be handled in parallel.

For anyone facing this problem, I have posted a sample project based on my solution.

EDIT:

The new Google Maps v2 library supports simultaneous zoom and pan. Unless there is a need to customize the event handling algorithm, I strongly recommend upgrading to the new library.

acj
  • 4,821
  • 4
  • 34
  • 49
  • How does the new library support simultaneous pan and zoom? I'm making calls to `moveCamera`, and when I do one `moveCamera` using `scrollBy` (panning) and then another `moveCamera` using `zoomBy` (for zooming), they appear to "fight" each other and only the second move seems to take effect? – aardvarkk Feb 20 '14 at 15:19
  • Sorry, my question was about simultaneous pan and zoom based on touch events from the user. I think you might be able to use `animateCamera()` to solve your problem, though - see [this answer](http://stackoverflow.com/a/13936465/357055). – acj Feb 20 '14 at 16:28