7798-ObjectAnimator-rotation (#7907)

This commit is contained in:
Tobrun
2017-02-07 07:31:39 +01:00
committed by GitHub
parent 937fa0ce44
commit 2c7350c093
4 changed files with 18 additions and 79 deletions

View File

@@ -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);
}
}

View File

@@ -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>