-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Tilt On Android #2805
Comments
@1ec5 From my reading of relevant tickets, there are still a few bugs and functions that don't take into account tilt? Just want to make sure we have a list of the ones that have not been fixed to include as known issues with tilt in the release notes. |
Looking at the how iOS implemented tilt in https://github.com/mapbox/mapbox-gl-native/pull/2159/files and https://github.com/mapbox/mapbox-gl-native/pull/2193/files it appears that the Core GL has the necessary API for Android implementation. We should be able to wire this up with JNI and have what we need for the Android bindings API. The outstanding question is going to be how much will the Android bindings API look like the Google Maps for Android Camera API? Google Maps Android API uses. I think we can get by (for now) with simply implementing // Construct a CameraPosition focusing on Mountain View and animate the camera to that position.
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(MOUNTAIN_VIEW) // Sets the center of the map to Mountain View
.zoom(17) // Sets the zoom
.bearing(90) // Sets the orientation of the camera to east
.tilt(30) // Sets the tilt of the camera to 30 degrees
.build(); // Creates a CameraPosition from the builder
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); |
On iOS, we modeled MGLMapCamera after MKMapCamera, since the goal is to more or less match MapKit. The APIs there are intent-driven. You don’t need a lesson on zoom levels and viewing angles to come up with the right values; instead, you decide how high the viewpoint is and what it’s looking at. But if the Google Maps SDK provides literal access to zoom levels and tilt, I think it’d be perfectly reasonable (and more expedient) for the Mapbox Android SDK to do likewise. |
I've started building out the CameraPosition API bindings. There's still a bit more work to be done on them, but once finished I'll then look to create the JNI bindings and then tie the two layers together. |
I just added a sample |
…nimateCamera. Setting default location of TiltActivity to DC for more obvious change.
…dding FloatRange annotations to setTilt() and tilt() methods.
From chat earlier today @zugaldia and I decided to punt on full Camera API support for the time being. Instead the focus of this ticket / feature will be the Gesture support and the stock |
…nimateCamera. Setting default location of TiltActivity to DC for more obvious change.
…dding FloatRange annotations to setTilt() and tilt() methods.
Rebase, Merge, Done. |
Bravo. |
The Core GL work to support perspective was done by @ansis at the end of August. @1ec5 added iOS bindings for it #2159 and #2193. Now that the initial version of the Android SDK (v 2.1.0) has been released (as of 21-Oct-2015) we should add support in Android.
/cc @mapbox/mobile @twbell
The text was updated successfully, but these errors were encountered: