Rotate camera in the shortest path. (#426)
* Rotate camera in the shortest path. * Revert "Rotate camera in the shortest path." This reverts commit 0858d5ba * Fix puck rotate error. * Remove useless codes. * Update test cases
This commit is contained in:
@@ -114,9 +114,9 @@ final class LocationAnimatorCoordinator {
|
||||
// replace the animation start with the camera's previous value
|
||||
latLngValues[0] = previousCameraLatLng;
|
||||
if (isGpsNorth) {
|
||||
bearingValues = new Float[] {previousCameraBearing, 0f};
|
||||
bearingValues = new Float[] {previousCameraBearing, shortestRotation(0f, previousCameraBearing)};
|
||||
} else {
|
||||
bearingValues[0] = previousCameraBearing;
|
||||
bearingValues = getBearingValues(previousCameraBearing, newLocations);
|
||||
}
|
||||
updateCameraAnimators(latLngValues, bearingValues);
|
||||
|
||||
|
||||
@@ -171,6 +171,35 @@ class LocationAnimatorCoordinatorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun feedNewLocation_animatorValue_bearing() {
|
||||
val previous = Location("")
|
||||
previous.latitude = 51.1
|
||||
previous.longitude = 17.1
|
||||
previous.bearing = 355f
|
||||
|
||||
val current = Location("")
|
||||
current.latitude = 51.2
|
||||
current.longitude = 17.2
|
||||
current.bearing = 0f
|
||||
|
||||
locationAnimatorCoordinator.feedNewLocation(arrayOf(previous, current), cameraPosition, false, false)
|
||||
|
||||
verify {
|
||||
animatorProvider.floatAnimator(
|
||||
arrayOf(0f, -5f, 0f), any(), any()
|
||||
)
|
||||
}
|
||||
|
||||
locationAnimatorCoordinator.feedNewLocation(arrayOf(previous, current), cameraPosition, true, false)
|
||||
|
||||
verify {
|
||||
animatorProvider.floatAnimator(
|
||||
arrayOf(0f, 0f), any(), any()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun feedNewLocation_animatorValue_multiplePoints_animationDuration() {
|
||||
every { projection.getMetersPerPixelAtLatitude(any()) } answers { 10000.0 } // disable snap
|
||||
|
||||
Reference in New Issue
Block a user