4
  1. Setup a fullscreen map
  2. Set some padding e.g: map.setPadding(0, 200, 0, 0)
  3. Tilt + rotate the map, as a user would
  4. Try to reset the tilt/rotation using CameraPosition like that:

    CameraPosition cameraPosition = CameraPosition.builder()
            .target(userLatLng)
            .zoom(zoomLevel)
            .tilt(0)
            .bearing(0)
            .build();
    CameraUpdate update = CameraUpdateFactory.newCameraPosition(cameraPosition);
    map.animateCamera(cameraUpdate, mapAnimationCallback);
    

You will see that we map has 0 tilt and 0 bearing but the target will not be the same as userLatLng. It will always have some offset.

If you have no map padding (map.setPadding(0, 0, 0, 0)) the whole animation works fine.

Any idea why this is happening/ how to make a proper animation with tilt/bearing while having padding?

Diolor
  • 13,181
  • 30
  • 111
  • 179

1 Answers1

2

It's a still open bug since Oct 3, 2013.

https://code.google.com/p/gmaps-api-issues/issues/detail?id=5881&q=padding&sort=-stars&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Internal%20Stars

It also looks like uneven padding is the root cause. I.e. map.setPadding(0, 200, 0, 200) will give you a correct animation.

Diolor
  • 13,181
  • 30
  • 111
  • 179