Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - using bearing clockwise versus counterclockwise (#6917)
Browse files Browse the repository at this point in the history
* [android]  - using bearing clockwise versus counterclockwise

* fixup brackets
  • Loading branch information
tobrun committed Nov 7, 2016
1 parent 15275db commit a7ccd86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public void onSensorChanged(SensorEvent event) {

private void rotateCamera(float rotation) {
CameraPosition.Builder builder = new CameraPosition.Builder();
builder.bearing(-rotation);
builder.bearing(rotation);
mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(builder.build()), COMPASS_UPDATE_RATE_MS, false /*linear interpolator*/, false /*do not disable tracking*/, null);
}

Expand Down Expand Up @@ -694,7 +694,7 @@ void updateLatLng(@NonNull Location location) {
// add direction
if (myBearingTrackingMode == MyBearingTracking.GPS) {
if (location.hasBearing()) {
builder.bearing(-location.getBearing());
builder.bearing(location.getBearing());
}
setCompass(0);
}
Expand Down
8 changes: 4 additions & 4 deletions platform/android/src/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ jdoubleArray nativeGetCameraValues(JNIEnv *env, jni::jobject* obj, jlong nativeM
jdouble buf[5];
buf[0] = latLng.latitude;
buf[1] = latLng.longitude;
buf[2] = -(nativeMapView->getMap().getBearing()-360);
buf[2] = -nativeMapView->getMap().getBearing();
buf[3] = nativeMapView->getMap().getPitch();
buf[4] = nativeMapView->getMap().getZoom();
env->SetDoubleArrayRegion(output, start, leng, buf);
Expand Down Expand Up @@ -1008,7 +1008,7 @@ void nativeJumpTo(JNIEnv *env, jni::jobject* obj, jlong nativeMapViewPtr, jdoubl

mbgl::CameraOptions options;
if (angle != -1) {
options.angle = angle * M_PI / 180;
options.angle = (-angle * M_PI) / 180;
}
options.center = mbgl::LatLng(latitude, longitude);
options.padding = nativeMapView->getInsets();
Expand All @@ -1028,7 +1028,7 @@ void nativeEaseTo(JNIEnv *env, jni::jobject* obj, jlong nativeMapViewPtr, jdoubl

mbgl::CameraOptions cameraOptions;
if (angle != -1) {
cameraOptions.angle = angle * M_PI / 180;
cameraOptions.angle = (-angle * M_PI) / 180;
}
cameraOptions.center = mbgl::LatLng(latitude, longitude);
cameraOptions.padding = nativeMapView->getInsets();
Expand Down Expand Up @@ -1061,7 +1061,7 @@ void nativeFlyTo(JNIEnv *env, jni::jobject* obj, jlong nativeMapViewPtr, jdouble

mbgl::CameraOptions cameraOptions;
if (angle != -1) {
cameraOptions.angle = angle * M_PI / 180 ;
cameraOptions.angle = (-angle * M_PI) / 180 ;
}
cameraOptions.center = mbgl::LatLng(latitude, longitude);
cameraOptions.padding = nativeMapView->getInsets();
Expand Down

0 comments on commit a7ccd86

Please sign in to comment.