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

[android] #4326 - using the camera API vs getCameraPosition #4405

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,10 @@ public final void moveCamera(CameraUpdate update) {
public final void moveCamera(CameraUpdate update, MapboxMap.CancelableCallback callback) {
mCameraPosition = update.getCameraPosition(this);
mMapView.jumpTo(mCameraPosition.bearing, mCameraPosition.target, mCameraPosition.tilt, mCameraPosition.zoom);
if (mOnCameraChangeListener != null) {
mOnCameraChangeListener.onCameraChange(mCameraPosition);
}
if (callback != null) {
callback.onFinish();
}
invalidateCameraPosition();
}

/**
Expand Down Expand Up @@ -295,17 +293,15 @@ public void onCancel() {
if (callback != null) {
callback.onCancel();
}
invalidateCameraPosition();
}

@Override
public void onFinish() {
if (mOnCameraChangeListener != null) {
mOnCameraChangeListener.onCameraChange(mCameraPosition);
}

if (callback != null) {
callback.onFinish();
}
invalidateCameraPosition();
}
});
}
Expand Down Expand Up @@ -365,6 +361,7 @@ public void onCancel() {
if (callback != null) {
callback.onCancel();
}
invalidateCameraPosition();
}

@Override
Expand All @@ -376,6 +373,7 @@ public void onFinish() {
if (callback != null) {
callback.onFinish();
}
invalidateCameraPosition();
}
});
}
Expand All @@ -395,7 +393,12 @@ private long getDurationNano(long durationMs) {
*/
private void invalidateCameraPosition() {
mInvalidCameraPosition = false;
mCameraPosition = mMapView.invalidateCameraPosition();

CameraPosition cameraPosition = mMapView.invalidateCameraPosition();
if (cameraPosition != null) {
mCameraPosition = cameraPosition;
}

if (mOnCameraChangeListener != null) {
mOnCameraChangeListener.onCameraChange(mCameraPosition);
}
Expand Down