diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2017-02-07 07:31:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 07:31:39 +0100 |
commit | 2c7350c09375ad363e3a42f24956806a1385a7bc (patch) | |
tree | 745a44ef16c3376fa1d177f2cb44543d8cfbe3eb /platform/android/MapboxGLAndroidSDK/src/main | |
parent | 937fa0ce44df02d8c3fd0ff19bf104636a9c8bf3 (diff) | |
download | qtlocation-mapboxgl-2c7350c09375ad363e3a42f24956806a1385a7bc.tar.gz |
7798-ObjectAnimator-rotation (#7907)
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main')
2 files changed, 10 insertions, 11 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java index 29f6d4dccf..220d3322cb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java @@ -266,18 +266,9 @@ public class MarkerView extends Marker { * @param rotation the rotation value to animate to. */ public void setRotation(float rotation) { - // limit to 0 - 360 degrees - float newRotation = rotation; - while (newRotation > 360) { - newRotation -= 360; - } - while (newRotation < 0) { - newRotation += 360; - } - - this.rotation = newRotation; + this.rotation = rotation; if (markerViewManager != null) { - markerViewManager.animateRotationBy(this, newRotation); + markerViewManager.setRotation(this, rotation); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java index 710ffc329b..e6d7843d9f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java @@ -125,6 +125,14 @@ public class MarkerViewManager implements MapView.OnMapChangedListener { } } + public void setRotation(@NonNull MarkerView marker, float rotation) { + View convertView = markerViewMap.get(marker); + if (convertView != null) { + convertView.animate().cancel(); + convertView.setRotation(rotation); + } + } + /** * Animate a MarkerView to a given alpha value. * <p> |