Select to view content in your preferred language

Double tap zoom wont work after map has been rotated.

617
3
05-30-2012 05:22 AM
AleksiMajander
Emerging Contributor
Hey,

I have a problem with double tap zoom not working after the MapView is rotated. Is there a way to fix this or a way to disable onDoubleTap completely in MapView?

Aleksi
0 Kudos
3 Replies
AndyGup
Esri Regular Contributor
Aleksi, Did you see any errors in logcat right after you did a double tap? I believe the following code snippet will prevent double tap from propagating:

map.setOnTouchListener(new MapOnTouchListener(getApplicationContext(), map){
 @Override
 public boolean onDoubleTap(MotionEvent point) {
  Log.d("Test","onDoubleTap do nothing");
  return false;
 }
});


-Andy
0 Kudos
AleksiMajander
Emerging Contributor
Thank you for the reply, that snippet works great.

The double tap still zooms after map rotation, the problem is that it also moves the map depending on how much map is rotated. So after double tap i might be zoomed 5km of from the original map point i double-tapped.

Aleksi

--EDIT--

Found a workaround using

map.centerAt(map.toMapPoint(new Point(point.getX(), point.getY())), true);
double i = map.getRotationAngle();
map.setRotationAngle(0);
map.zoomin();
map.setRotationAngle(i);
return true;


in onDoubleTap(). Is there any better way to accomplish this?
0 Kudos
AndyGup
Esri Regular Contributor
Aleksi, I'm not able to duplicate...I have an app that rotates on pinch and the setOnTouchListener override works just fine on several phones.

Do you have an OnPinchListener set in addition to a setOnTouchListener?

-Andy
0 Kudos