use of com.mapbox.maps.CoordinateBounds in project maps by rnmapbox.
the class RCTMGLCamera method getUserLocationUpdateCameraOptions.
private CameraOptions getUserLocationUpdateCameraOptions(double zoomLevel) {
LatLng center = mUserLocation.getCoordinate();
ScreenCoordinate anchor = CameraAnimationsUtils.getCamera(mMapView).getAnchor();
CameraState actState = mMapView.getMapboxMap().getCameraState();
if (mUserLocationVerticalAlignment != UserLocationVerticalAlignment.CENTER) {
CameraOptions options = ExtensionUtils.toCameraOptions(actState, anchor);
CoordinateBounds bounds = mMapView.getMapboxMap().coordinateBoundsForCamera(options);
switch(mUserLocationVerticalAlignment) {
case UserLocationVerticalAlignment.TOP:
center = new LatLng(bounds.getNortheast().latitude(), center.getLongitude());
break;
case UserLocationVerticalAlignment.BOTTOM:
center = new LatLng(bounds.getSouthwest().latitude(), center.getLongitude());
break;
}
}
return new CameraOptions.Builder().center(center.getPoint()).bearing(getDirectionForUserLocationUpdate()).pitch(mPitch).anchor(anchor).padding(actState.getPadding()).zoom(zoomLevel).build();
}
Aggregations