Add getDirection and getCenterCoordinateZoomLevel to android.

This commit is contained in:
bsudekum
2016-01-11 17:15:11 -08:00
parent 5a69e10b84
commit 18215fa53f
7 changed files with 62 additions and 6 deletions
@@ -201,8 +201,8 @@ public class ReactNativeMapboxGLManager extends SimpleViewManager<MapView> {
view.setDebugActive(value);
}
@ReactProp(name = PROP_DIRECTION, defaultFloat = 0f)
public void setDirection(MapView view, float value) {
@ReactProp(name = PROP_DIRECTION, defaultDouble = 0)
public void setDirection(MapView view, double value) {
view.setDirection(value, true);
}
@@ -334,6 +334,23 @@ public class ReactNativeMapboxGLManager extends SimpleViewManager<MapView> {
view.removeAllAnnotations();
}
public WritableMap getDirection(MapView view) {
WritableMap callbackDict = Arguments.createMap();
callbackDict.putDouble("direction", view.getDirection());
return callbackDict;
}
public WritableMap getCenterCoordinateZoomLevel(MapView view) {
WritableMap callbackDict = Arguments.createMap();
LatLng center = view.getCenterCoordinate();
double zoom = view.getZoomLevel();
callbackDict.putDouble("latitude", center.getLatitude());
callbackDict.putDouble("longitude", center.getLongitude());
callbackDict.putDouble("zoomLevel", zoom);
return callbackDict;
}
public MapView getMapView() {
return mapView;
}