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

Commit

Permalink
[android] #5438 - add bearing to MyLocationView for the SDK camera ob…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
tobrun committed Jul 11, 2016
1 parent caba8c1 commit a0171f9
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public void onAnimationUpdate(ValueAnimator animation) {
private Matrix matrix;
private Camera camera;
private PointF screenLocation;

// camera vars
private float bearing;
private float tilt;

@MyLocationTracking.Mode
Expand Down Expand Up @@ -260,7 +263,7 @@ protected void onDraw(Canvas canvas) {

// apply tilt to camera
camera.save();
camera.rotate(tilt, 0, 0);
camera.rotate(tilt, 0, bearing);

// map camera matrix on our matrix
camera.getMatrix(matrix);
Expand Down Expand Up @@ -301,6 +304,15 @@ public void setTilt(@FloatRange(from = 0, to = 60.0f) double tilt) {
this.tilt = (float) tilt;
}

public void setBearing(double bearing) {
this.bearing = (float) bearing;
}

public void setCameraPosition(CameraPosition position) {
setTilt(position.tilt);
setBearing(position.bearing);
}

public void onPause() {
compassListener.onPause();
toggleGps(false);
Expand Down

0 comments on commit a0171f9

Please sign in to comment.