From fa972fad60e58e5b8f9f9622f508e9732c8c9ffd Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 9 Jun 2017 11:11:33 +0200 Subject: [PATCH] [android] - update components with camera values when animating (#9174) --- .../main/java/com/mapbox/mapboxsdk/maps/Transform.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java index 9a8997014a5..505e440dcb9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java @@ -150,6 +150,10 @@ CameraPosition invalidateCameraPosition() { cameraChangeDispatcher.onCameraMove(); } + if (isComponentUpdateRequired(cameraPosition)) { + updateCameraPosition(cameraPosition); + } + this.cameraPosition = cameraPosition; if (onCameraChangeListener != null) { onCameraChangeListener.onCameraChange(this.cameraPosition); @@ -158,6 +162,11 @@ CameraPosition invalidateCameraPosition() { return cameraPosition; } + private boolean isComponentUpdateRequired(@NonNull CameraPosition cameraPosition) { + return this.cameraPosition != null && (this.cameraPosition.tilt != cameraPosition.tilt + || this.cameraPosition.bearing != cameraPosition.bearing); + } + void cancelTransitions() { // notify user about cancel cameraChangeDispatcher.onCameraMoveCanceled();